Filter Cross Site Lookup by Person Field

Discussions about Cross-site Lookup
Posts: 96
Joined: Sun May 10, 2015

13 Sep 2018


my environment:
SharePoint Online
Cross-site lookup Version 1.4.4

How can I filter a cross-site lookup (resource) based on a person?
My starting situation:
I have a ticket list. Each ticket has a ticket creator (person field).
There are a list of resources. Each resource is assigned to an owner (person field).

When creating a ticket, a resource (cross-site-lookup) is assigned.
How can I filter the resource depending on the ticket creator?
Only the resources assigned to the ticket creator in the resources list should be displayed.

Thanks for your help!

User avatar
Posts: 232
Joined: Mon Aug 27, 2018

13 Sep 2018


Please, use the following code:

Code: Select all

function (term, page) {
  var creator = fd.field('PersonCreator').value()[0];
  if (creator) {
  	var creatorEmail = creator.EntityData.Email;
  } else {
  	var creatorEmail = "";
  if (!term || term.length == 0) {
    return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Person/EMail&$orderby=Created desc&$expand=Person/EMail&$filter=Person/EMail eq '" + creatorEmail + "'&$top=10";
  return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Person/EMail&$orderby={LookupField}&$expand=Person/EMail&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "') and Person/EMail eq '" + creatorEmail + "'&$top=10";

'PersonCreator' is an internal name of the current form field, 'Person' is an internal name of lookup item field.

Posts: 96
Joined: Sun May 10, 2015

14 Sep 2018

Perfect. Thank you!

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests