Cross site dropdown giving wrong value on related item

Discussions about Cross-site Lookup
Locked
User avatar
Roo
Posts: 107
Joined: Tue Oct 24, 2017

04 Oct 2018

I have a Crosssitelookup field(s) on a form which brings in an employee on the form.

I then have a related item field that is linked to a document library.

In the Javascript I have a bit of code (that works elsewhere)

fd.updateDroppedDocuments($('.SCForm'), function(listItem) {
//get the values from the Form fields:
var employee = fd.field("Employee_x0020_Name").value();

//set the values on uploaded document:
listItem.set_item('Employee_x0020_Name', employee);

listItem.update();
});


This should update a field Employee_x0020_Name from the form to the Employee_x0020_Name on the child library. However instead of doing this it gives a number?
csluissue.gif
csluissue.gif (25.04 KiB) Viewed 6954 times
What am I doing wrong?

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

05 Oct 2018

Hi Roo,

It happens because the code 'var employee = fd.field("Employee_x0020_Name").value();' returns an ID for Cross-site lookup field.

You should use in this case:

Code: Select all

var employee = fd.field("Employee_x0020_Name").control('data')['Title']; 
Notice that you should replace 'Title' with the internal name of the field you want to retrieve.

You can read more about getting and setting values of the fields in the article: https://spform.com/javascript-framework ... eld-values

User avatar
Roo
Posts: 107
Joined: Tue Oct 24, 2017

08 Oct 2018

Thanks. I looked through that list and didn't see the cross site parameters - Sorry

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests