Page 1 of 1

Cross site dropdown giving wrong value on related item

Posted: 04 Oct 2018
by Roo
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 6989 times
What am I doing wrong?

Re: Cross site dropdown giving wrong value on related item

Posted: 05 Oct 2018
by AlexZver
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

Re: Cross site dropdown giving wrong value on related item

Posted: 08 Oct 2018
by Roo
Thanks. I looked through that list and didn't see the cross site parameters - Sorry