Page 1 of 1

CSL field value not being set

Posted: 05 Sep 2017
by EFerguson
Hello,

I am trying to setup a CSL field that points to a user field in another list in the same site. The CSL field displays the list of approvers but when I select a name the CSL field does not update.

I added the following alerts to the CSL field's onchange event,

-- alert(fd.field("FBA").value());
-- alert(fd.field('FBA').control('data')['Title']);

It returns 1 for the value, which is the correct item id of the item I selected. It returns blank for the Title. And the field does not get populated.

This is the JS from my CSL field.

Request items:
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id," +
"{LookupField},Approver/Title&$expand=Approver&$orderby=Created desc&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id," +
"{LookupField},Approver/Title&$expand=Approver&" +
"$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "')&$orderby=Created desc&$top=10";
}

Item format:
function(item) {
return '<span class="csl-option">' + item["Approver"].Title + '</span>'
}

Thank you for your help.

Re: CSL field value not being set

Posted: 06 Sep 2017
by Nikita Kurguzov
Hello!
Cross-site Lookups simply do not support Person fields, just like original Lookup fields. You can choose Person fields like you can choose any other field, but they wouldn't work. Instead, try to use another field on the Form.