Lookup Extra Field Get Value

Hi Again,
What is the correct script to get a lookup extra field value and pass it to another form control.

When end user select a lookup value another control value will get the lookup extra field value in same time

Answering my self hehehehhe
i get it :slight_smile:

Help link 01

Help link 02

Dear Georges,

I’m glad you find it out! Nice work! :sunglasses:

Help link 02
https://spform.com/javascript-framework/getting-setting-sharepoint-form-field-values

To anyone wondering, this code is specific to our older product - Forms Designer.

For newer product - Plumsail Forms, please, use the following examples - SharePoint field types — SharePoint forms

For Lookup fields, please include fields you want to retrieve inside Extra Fields setting:
image

Then the following code should work:

//all code should be inside appropriate events for form to load
fd.spRendered(function(){
  //returns Title of the selected item
  fd.field('Lookup').value.Title;

  //returns Title of the first selected item in Multi Lookup
  fd.field('LookupMulti').value[0].Title;
});

I have an issue on this; If I want to get the extra field value of a lookup inside a ready-statement, I’m not able to get the value. After I change the lookup value manually on the form, the value is available by javascript:

fd.field('Lookup').ready().then(function(field) {
    console.log(field.value.Title);
});

Any suggestions?

Dear @phil,

Please use the approach described in Dynamically update Lookup Column

This is a workaround to retrieve an appropriate Lookup Id because when a form loads the lookup field has minimal data (for optimization purposes). After manual selection, the lookup field contains full data including extra fields.

fd.field("Lookup").widget.dataSource.data(); always retrieves full data.

1 Like