Not applicable

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

Jeremy Jaya Raj‌, one of our Nintex developers, has shared how you can query a SharePoint list form another list in Nintex Forms for Office 365!

Querying a SharePoint list from another list in Nintex Forms 2013 and 2010 is possible using the lookup control, but how do we achieve this in Nintex Forms for 0ffice 365?

A. There is good news, custom Javascript and JSOM will allow us to achieve this, but how are we going to do that?


We have an Inventory List. In the Inventory Form, we would like to have a lookup which loads a list of products. When the lookup value changes, we would like to query our products list and return all the details of the selected product.

This can be achieved through JavaScript.

Since we already have our SharePoint client context loaded in our client, we can write scripts to query any list on that web using JSOM (JavaScript Object Model). Refer to code snippet below:


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);


           img.attr('src', imgUrl);





function(){ alert("Error");});



Referring to the snippet above, basically we are querying our product list with the id from the lookup control and populating a few textboxes with the details of the selected product.

Insert the code snippet in Form Settings > Custom JavaScript. Please make sure your ids of all your elements match.

Using this same concept and applying JSOM we can achieve many SharePoint related operations in our forms that makes Nintex Forms for Office 365 even more powerful. However, some lists might not be able to be queried due to permission levels.

Enjoy exploring and give it a go to unleash the full potential of Nintex Forms. Comments and ideas are most welcomed.

This document was generated from the following discussion: How to query a SharePoint list from another list in Nintex Forms for O365.

1 Reply

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

I try below code for connecting to another site collection and it always fails,

function checkURL()
//var ctx = new SP.ClientContext.get_current();

var siteURL = "";
var clientContext = new SP.ClientContext(siteURL);

var web = clientContext.get_web();
clientContext.executeQueryAsync(Function.createDelegate(this, this.successfunction), Function.createDelegate(this, this.failfunction));
function successfunction()
function failfunction()

Do you know how exactly to connect another site collection from nintex form?

0 Kudos