lookup value
-
- Posts: 1
- Joined: Mon Dec 05, 2016
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));
}
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));
}
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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.
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.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 3 guests