Added lookup column values
Posted: 29 Jun 2019
The first CSL, Bill_x0020_To_x0020_Contact, has the additional column "Client", a CSL field. The second CSL needs to use the "Client ID" from the first CLS's client lookup field as the filter. Can't seem to get this to work. Please help.
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},WorkPhone,CellPhone,Email,Client/Id&$expand=Client/Id&$orderby={LookupField}&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},WorkPhone,CellPhone,Email,Client/Id&$expand=Client/Id&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "')&$top=10";
}
function (term, page) {
if (!term || term.length == 0) {
var clientId = fd.field('Bill_x0020_To_x0020_Contact').control('data')['Client'];
if (!clientId) {
clientId = 0;
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Street,City,State,Zip&$orderby={LookupField}&$filter=ID eq " + clientId + "&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Street,City,State,Zip&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "') and ID eq " + clientId + "&$top=10";
}
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},WorkPhone,CellPhone,Email,Client/Id&$expand=Client/Id&$orderby={LookupField}&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},WorkPhone,CellPhone,Email,Client/Id&$expand=Client/Id&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "')&$top=10";
}
function (term, page) {
if (!term || term.length == 0) {
var clientId = fd.field('Bill_x0020_To_x0020_Contact').control('data')['Client'];
if (!clientId) {
clientId = 0;
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Street,City,State,Zip&$orderby={LookupField}&$filter=ID eq " + clientId + "&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Street,City,State,Zip&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "') and ID eq " + clientId + "&$top=10";
}