Page 1 of 1

lookup value

Posted: 06 Dec 2016
by faridrazali18
i have this code which should lookup value inside custom list, but i doesnt work..need help urgently..

Please note i dont have cross site lookup extension, this is purely js



var yy = 2017;

var str = yy.toString();

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

var anList = anContext.get_web().get_lists().getByTitle('Employee Leave Record List');

anContext.load(anList);

var camlQueryAnother = new SP.CamlQuery();

camlQueryAnother.set_viewXml('<View><Query><Where><Eq><FieldRef Name=\'Year\'/>' + '<Value Type=\'lookup\'>' + str + '</Value></Eq></Where></Query></View>');

var collListItemAnother = anList.getItems(camlQueryAnother);

anContext.load(collListItemAnother);

context.executeQueryAsync(function ()

{

var anlistItemEnumerator = collListItemAnother.getEnumerator();



while (anlistItemEnumerator.moveNext())

{

anListItem = anlistItemEnumerator.get_current();

fd.field('entitleLeave').value(oListItem.get_item('Entitled_x0020_Leave').toFixed(1));

fd.field('leaveTaken').value(oListItem.get_item('Taken_x0020_Leave').toFixed(1));

fd.field('leaveToBeApproved').value(oListItem.get_item('Leave_x0020_To_x0020_Be_x0020_Ap').toFixed(1));

}

Re: lookup value

Posted: 07 Dec 2016
by Dmitry Kozlov
Hi,

Our support team can assist you with the script. It will take 100 support minutes. If it is OK, purchase the support minutes in our store:

http://spform.com/buy

Then send templates of both lists (List settings -> Save this list as template) and the form (export it in Forms Designer) to support@spform.com.