clxwas3
Novice

Re: How to query a SharePoint list from another list in Nintex Forms for O365.

hello,

Thanks for you code.

Do you know why this messages display:'clientContext' is undefined.2015-11-09_081846.png

Reply
christopheraucq
Apprentice

Re: How to query a SharePoint list from another list in Nintex Forms for O365.

Hi,

Try to insert this line before

var clientContext = new SP.ClientContext.get_current();

Reply
francois
Apprentice

Re: How to query a SharePoint list from another list in Nintex Forms for O365.

It doesn't work because the SharePoint JS is not yet loaded.

You can find more details here: Using JSOM in Nintex Forms for O365 or intex Forms O365 - Getting SharePoint ClientContext Do's and Dont's

0 Kudos
Reply
Not applicable

Re: How to query a SharePoint list from another list in Nintex Forms for O365.

Jeremy,

  I am trying to get this code working. And, for some reason cannot get it to go. I am using Nintex forms SP2013.

I have a Products list with four products, I have a lookup list that shows the IDs of those products and I have four fields called

imgUrlTextBox, code, productPrice and productName. I have put your code in the Settings at the form level. But, when I change the
value in the dropdown named LookupProduct; nothing happens in the other fields. Is there an on-click event that I need to fire or
something else I need to hook up?

0 Kudos
Reply
cclements
Novice

Re: How to query a SharePoint list from another list in Nintex Forms for O365.

Do any of you guys have an example of accessing the SharePoint Lists REST API from an Nintex (for Office 365) Form?  The sticking point is the need for a token I think.  I don't want to rewrite all this to use JSOM.

0 Kudos
Reply
kelliganp
Scholar

Re: How to query a SharePoint list from another list in Nintex Forms for O365.

Hi Jeremy Jaya Raj,

I am trying to get this going but am pretty new to JS. I pasted your script exactly into Settings >> Custom JavaScript (here is mine):

NWF$(document).ready(function(){  
var obj = NWF$("#" + LookupProduct); 
obj.change(function(){ 
      var web = clientContext.get_web();   
      var oList = clientContext.get_web().get_lists().getByTitle("Products"); 
      var listItem = oList.getItemById(this.value);  
      clientContext.load(listItem, "Title", "Code", "Price", "ImageUrl");  
      clientContext.executeQueryAsync(function(){  
           var img = NWF$("#image"); 
           var code = NWF$("#" + ProductCode);    
           var productPrice = NWF$("#" + ProductPrice);     
           var productName = NWF$("#" + ProductName); 
           var imgUrl = listItem.get_item('ImageUrl'); 
           var imgUrlTextBox = NWF$("#" + ImageUrlVal); 
           imgUrlTextBox.val(imgUrl); 
           img.attr('src', imgUrl);  
           code.val(listItem.get_item('Code')); 
           productPrice.val(listItem.get_item('Price').toFixed(2)); 
           productName.val(listItem.get_item('Title')); 
}, 
function(){ alert("Error");}); 
}); 
});

I created 2 lists and a library:

   List 1: Products

   List 2: Inventory (no custom fields but I added controls to the form):

      The control names are in the green boxes...

Finally, the Product Image Library

 Do I have anything cross threaded here?

I do not know how to configure the Image panel to get a dynamic url...

Here is what is returned when I click "New item" in the list:

   Debugger Tab:

   Console Tab:

...and, here is what is returned when I look up an item in the published "Inventory" form:

Please let me know where you think I went wrong.

Regards,

0 Kudos
Reply
clxwas3
Novice

Re: How to query a SharePoint list from another list in Nintex Forms for O365.

try: 

var obj = NWF$('#' + LookupProduct);
Reply
kelliganp
Scholar

Re: How to query a SharePoint list from another list in Nintex Forms for O365.

Hi Shiyao Wang‌,

I made your adjustment and the issue passed down further.

I saw that you had the same issue above and made the change that Christophe advised. Now I get the following ambiguous error.

Any thoughts?

==========================================

=========== Edit ===========================

==========================================

Hi Shiyao and Jeremy,

I did a bit more digging and came up with this error also:

let me know if you have any thought on these...

0 Kudos
Reply
Not applicable

Re: How to query a SharePoint list from another list in Nintex Forms for O365.

Hi Jeremy, you are looks more helpful to every one. Thanks. I m very new in nintex form. How we can can display product value after enter product code by using control as i dont know codingin java?  

0 Kudos
Reply