Mapping Lookup Control Field to current SharePoint list

In my lookup control field, I am trying to map an extra field to my current SharePoint list. The extra field (“Fund”) and the field I am trying to map to (‘ApproximateRT_x0020_’) are both text fields. I’ve tried the code below but it is not updating the ‘ApproximateRT_x0020_’ SharePoint field.

fd.spRendered(function() {
    // Capture change events on the CtrlLookup field
    fd.control('CtrlLookup').$on('change', function(value) {
        if (value) {
            // Capture the value of the 'Fund' extra field
            var fundValue = value.Fund;

            // Set the captured 'Fund' value to the 'ApproximateRT_x0020_' field
            fd.control('ApproximateRT_x0020_').value = fundValue;
        }
    });

    //Set initial value if editing an existing item
    if (fd.itemId && fd.control('CtrlLookup').value) {
        var initialValue = fd.control('CtrlLookup').value.Fund;
        fd.control('ApproximateRT_x0020_').value = initialValue;
    }
});

Hey @MRizz226,

You need to use fd.field('ApproximateRT_x0020_') instead of fd.control('ApproximateRT_x0020_') in both cases, that should solve the problem.
If the issue persists, please open the form in SharePoint, press F12, and share a screenshot of errors in the console.

1 Like