AnsweredAssumed Answered

Nintex Forms - getting list items by javascript

Question asked by rubi on Oct 2, 2017
Latest reply on Oct 2, 2017 by rubi

Dear Community, 


Couldn't find any posts that helped me, so I create a new one...


I'm trying to get item information from a list based on a lookup field. 

So I implemented a little javascript that's fired by a button.


function updateSupplierTemplate(){
var ctx = new SP.ClientContext.get_current();
var myList = ctx.get_web().get_lists().getByTitle('SupplierTemplates');
var templateID = NWF.RuntimeFunctions.parseLookup(NWF$("#" + supplierTemplate).val(), false);
var myItem = myList.getItemById(templateID);
ctx.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
function onQuerySucceeded() {
NWF$("#" + supplierStreet).val(sStreet);
function onQueryFailed(sender, args) {
alert('Request failed. \nError: ' + args.get_message() + '\nStackTrace: ' + args.get_stackTrace());


I could see with an alert box, that my lookupID variable is set fine. 

Also the SP.Context must be available because it returns an [object] in an alert box.


The query goes in success function what I checked with an alert action. But as soon as I want to access myItem it returns "object not defined" in the developer function of the browser. 

Is this not a supported way to work with SP items inside a Nintex form?


Thanks for any help in advance.