LookupDependent Extra Fields Not Refreshing

Greetings!

I have reviewed my own posts that relate to the subject of Lookup fields, looked again at your Extra Fields documentation, and searched against other community posts that had keywords such as “Extra Fields“ and ”LookupDependent”. I have also tried various tests and it seems I have failed to recall this simple task of getting extra fields to update on change of the lookup field itself. It seems obvious but I can’t quite reach the goal.

LIST 1: Main list with Lookup column ‘referencesdemo’ which references ReferencesDemo (Source/List 2)

LIST 2: Source list ReferencesDemo with several columns that all should be populated on change

GOAL: (screen captures from three samples; for testing purposes, I have added text controls to show the internal name and type of each extra field)

User selects one of the Core Books:

User selects one of the Journals:

User selects one of the Websites:

CURRENT BEHAVIOR:

None of the extra fields change when ‘referencedemo’ field changes.

CODE ATTEMPTS: (there were many more but I am starting from scratch now)

//Ready 'referencesdemo' Lookup field > THIS WORKS

fd.spRendered(function() {

	fd.field('referencesdemo').ready(field => {

	alert('Your item is now ready for development.');

    });

});
//Trying to update extra fields when 'referencesdemo' Lookup field changes > DOES NOT WORK

fd.spRendered(function() {

fd.field('referencesdemo').ready(function() {

fd.field('referencesdemo').$on('change', function(value) {

//core-book

	fd.field('referencesdemo_x003a_core_x002d_').value = value.LookupValue;

	fd.field('referencesdemo_x003a_core_x002d_0').value = value.LookupValue;

	fd.field('referencesdemo_x003a_core_x002d_1').value = value.LookupValue;

	fd.field('referencesdemo_x003a_core_x002d_2').value = value.LookupValue;

	fd.field('referencesdemo_x003a_core_x002d_3').value = value.LookupValue;

	fd.field('referencesdemo_x003a_core_x002d_4').value = value.LookupValue;

//journals

	fd.field('referencesdemo_x003a_journal_x00').value = value.LookupValue;

	fd.field('referencesdemo_x003a_journal_x000').value = value.LookupValue;

//website

	fd.field('referencesdemo_x003a_website').value = value.LookupValue;

	fd.field('referencesdemo_x003a_website_x00').value = value.LookupValue;

//ID

	fd.field('referencesdemo_x003a_ID').value = value.LookupValue;

	});

    });

});

@Margo - your statement “Values of the additional columns will be displays only after the data is saved” in this post, and the link to more info when we “want to show this values instantly when user selects an option in a lookup dropdown”, I have also tried adding the extra fields but have had no luck. I will keep trying :slight_smile: but it occurs to me - are Extra Fields those which are built-in SharePoint/EntraID fields, or so they also support those fields we create in SP?

Hello @shedev,

Additional fields selected for a lookup column will not automatically update when the lookup field value changes:

To display this data instantly on the form when a user selects an option in the lookup column, follow these steps:

  • Add a Common Text field or Text control corresponding to each additional column you want to display.

    If you decide to go with common fields, you can disable them.

  • Define the internal field names of the data you want to retrieve from the source list. Do not use these names:

    referencesdemo_x003a_core_x002d_
    referencesdemo_x003a_core_x002d_3
    

    These are names of the Additional columns you've selected in the field settings, you don't need them.

    Go to the ReferencesDemo list and get the correct internal names of the columns there. List names in the Extra fields property:

  • Add code to populate the Common Text fields when the value of the Lookup field changes:

    fd.spRendered(function() {
        fd.field('referencesdemo').ready(field => {
            field.$on('change', value => {
                //populate common field with extra column value
                fd.field('Text1').value = value.InetrnalNameExtraColumn
            });
        });
    });
    

    Replace InetrnalNameExtraColumn with the inetrnal name of the extra column.

Start with one column, if it works add others.

Thank you as always @Margo . DO you sometimes roll your eyes and shake your head with these questions? I am sorry because I know the answers largely exist somewhere already; the large volume of posts and finding the right search term sometimes defeat my best efforts. I hope you are well and I thank you so much for taking the time to spell out all of the details - sometimes for the nth time :smiling_face_with_three_hearts:

@shedev,

No, not really. :sweat_smile: It is okay to not understand something, and I'm here to explain. And when it comes to Lookups—it is pretty complex field and it trips me up sometimes too!

Have you managed to set it up?

@Margo - I got it figured out, yes. Thank you so much.I have some filtering to do and also some UI design work ahead, but the functionality is on target. Thank you as always. When it is looking clean, I will upload a screen capture here and mark as solved :slight_smile:

1 Like