Trouble Retrieving data
Posted: 10 Jul 2019
I have a list with a cross site lookup field looking to another list cross site look up field. My plan is to use the information in Forms Designer with an on change event. Currently it is bringing in an object as undefined. What is the problem with my code?
Here is the cross site look up that I am having a problem with (I bolded the problem item):
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},PLStatus,Title,PLProjManager/Id&$expand=PLProjManager&$orderby={LookupField} asc&$filter=PLStatus eq 'Active Project'&$top=30";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},PLStatus,Title,PLProjManager/Id&$expand=PLProjManager&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "') and PLStatus eq 'Active Project'&$top=30";
}
Here is the cross site lookup on the target:
function (term, page) {
var HRCompany = "Our Company Name";
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby=Created desc&$filter=CLCompanyCopy eq '"+ encodeURIComponent(HRCompany) + "'&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "') and CLCompanyCopy eq '"+ encodeURIComponent(HRCompany) + "'&$top=10";
}
Here is the cross site look up that I am having a problem with (I bolded the problem item):
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},PLStatus,Title,PLProjManager/Id&$expand=PLProjManager&$orderby={LookupField} asc&$filter=PLStatus eq 'Active Project'&$top=30";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},PLStatus,Title,PLProjManager/Id&$expand=PLProjManager&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "') and PLStatus eq 'Active Project'&$top=30";
}
Here is the cross site lookup on the target:
function (term, page) {
var HRCompany = "Our Company Name";
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby=Created desc&$filter=CLCompanyCopy eq '"+ encodeURIComponent(HRCompany) + "'&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "') and CLCompanyCopy eq '"+ encodeURIComponent(HRCompany) + "'&$top=10";
}