CSL field value not being set

Discussions about Cross-site Lookup
Locked
EFerguson
Posts: 5
Joined: Sat May 06, 2017

05 Sep 2017

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.

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

06 Sep 2017

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.
Cheers

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests