Cross-site field value

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
SPTech
Posts: 10
Joined: Wed May 27, 2015

03 Sep 2015

Hello,

I'm using a cross-site lookup field in one list(A) that looksup a value on another list(B).

On the list A in the new form I am trying to get the value of this lookup field using javascript when user choose a value from this field.

If I try fd.field('CrossSiteLookup').value() I get a number but in the form display name is shown. When I look this column using SP CAML Query Helper I get entries like this, "123;# Display Name". As I said if I use fd.field('CrossSiteLookup').value() I get 123, but I want to get "Display Name". How can I achieve this ?

Thanks in advance.

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

03 Sep 2015

Hello! If you have a single-value CSL field use:

Code: Select all

fd.field('CrossSiteLookup').control('data')['Title']
If you have a multi-value CSL field:

Code: Select all

fd.field('CrossSiteLookup').control('data')[index]['Title']
where index is a number starting from 0 that indicates the position of the value in the field you're trying to access Please note, that if you try to access an entry with no Title property (an empty entry), you'll get an exception.

SPTech
Posts: 10
Joined: Wed May 27, 2015

03 Sep 2015

Thank you for your reply. It is a single value CSL and I have tried fd.field('CrossSiteLookup').control('data')['Title'] and it does not generate an exception but for the value it says "undefined".

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

03 Sep 2015

Sorry, I did not mention that Title is the internal name of the target field, so substitute as appropriate.

SPTech
Posts: 10
Joined: Wed May 27, 2015

03 Sep 2015

Thank you, I was not using the internal name. Changed to code using internal name and it is working now.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests