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
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?
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.
Hi Jeremy Jaya Raj,
var obj = NWF$("#" + LookupProduct);
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");
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);
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:
...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.
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.
=========== Edit ===========================
I did a bit more digging and came up with this error also:
let me know if you have any thought on these...
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?