cancel
Showing results for 
Search instead for 
Did you mean: 
markthughes
Nintex Newbie

i am trying to update some values when an external data column

Jump to solution

is selected in Nintex forms, any ideas on how to trigger this?  any examples or articles?  I have done it with a names field before.

0 Kudos
Reply
1 Reply
markthughes
Nintex Newbie

Re: i am trying to update some values when an external data column

Jump to solution

i ended up using DOMNodeInserted event listener to the picker control, then it fires about 4 times everytime you pick something, so then i do my lookup and set the fields

NWF$(document).ready(function(){ExecuteOrDelayUntilScriptLoaded(loadConstants, "sp.js"); })

function loadConstants(){

var targetNodes = document.getElementsByClassName('empidjs1')[0];

ctr = 0;

targetNodes.addEventListener("DOMNodeInserted", function() {

ctr = ctr + 1;

//alert(ctr);

if(ctr == 4){

lookup1();

}

;

})}

function lookup1(){

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

var query = new SP.CamlQuery();

var id1 = document.getElementsByClassName('empidjs1')[0];

query.set_viewXml("<View><Query><Where><Eq><FieldRef Name='EMPID'/><Value Type='Text'>" + id1.children[0].childNodes[0].childNodes[0].childNodes[3].value+"</Value></Eq></Where></Query></View>");

      var web = ctx.get_web(); 

  var oList = ctx.get_web().get_lists().getByTitle("Employees");

  var  listItem = oList.getItems(query);

      ctx.load(listItem);

   ctx.executeQueryAsync(function(){

   getitems1(listItem);

ctr = 0;

})};

function getitems1(x){

var  FirstName = document.getElementById(firstname1);

var vartitle = document.getElementById(title1);

var lastName = document.getElementById(lastname1);

var listEnumerator = x.getEnumerator();

  while (listEnumerator.moveNext()) {

            FirstName.value =listEnumerator.get_current().get_item('First_x0020_Name');

lastName.value =listEnumerator.get_current().get_item('Last_x0020_Name');

vartitle.value =listEnumerator.get_current().get_item('Title');

}

}

;

0 Kudos
Reply