Lookup Control Field Problem

Hello,
I have a control lookup field, filtered by two other text fields, that fill in the field with the array instead only the value.



What I am doing wrong?
Thank you.

This is the JS code behind the form.

function filterDocumentTypes() {
    var varCompanyCode = fd.field('Company_x0020_Code').value;
    var varCategoryCode = fd.field('Category_x0020_Code').value;
    var strFilter = "Category_x0020_Code eq '" + varCategoryCode + "' and Company_x0020_Code eq '" + varCompanyCode + "'";
    fd.control('DocumentType').filter = strFilter;
    fd.control('DocumentType').refresh();
}

fd.spRendered(function() {

    fd.field('Title').disabled = false;
    fd.field('Supplier_x0020_Code').disabled = false;
    fd.field('Supplier_x0020_Email').required = false;
    fd.field('Category_x0020_Code').disabled = false;
    fd.field('Company_x0020_Code').disabled = false;
    fd.field('Status').disabled = false;
    fd.field('Attachments').required = false;
    
    fd.field('Title').hidden = false;
    fd.field('Supplier_x0020_Code').hidden = false;
    fd.field('Supplier_x0020_Email').hidden = false;
    fd.field('Category_x0020_Code').hidden = false;
    fd.field('Company_x0020_Code').hidden = false;
    fd.field('Status').hidden = false;

    //retrieve user profile informations
    graph.me().then(function(props) {
        console.log(props);
        fd.field('Title').value = props.givenName;
        fd.field('Supplier_x0020_Code').value = props.surname;
        fd.field('Category_x0020_Code').value = props.officeLocation;
        fd.field('Company_x0020_Code').value = props.jobTitle;
        fd.field('Supplier_x0020_Email').value = props.mail;
        
        fd.control('DocumentType').ready(function() {
        filterDocumentTypes();
        //filter DocumentType when Category changes
        fd.field('Category_x0020_Code').$on('change', function(value){
            filterDocumentTypes();
            fd.control('DocumentType').value = null;
        });
        //filter DocumentType when Company changes
        fd.field('Company_x0020_Code').$on('change', function(value){
            filterDocumentTypes();
            fd.control('DocumentType').value = null;
        });
    });
        
    });
});

Dear @stefano.mazzi,
You're not doing anything wrong, that's how the data is saved, but it should look like a hyperlink in List View - seems like it doesn't work anymore, most likely caused by a SharePoint update.

We've created a bug and it should be fixed in the nearest future.

Thanks for your feedback @Nikita_Kurguzov .
I hope will be solved asap.

Dear @stefano.mazzi,
Should be fixed now, please, restart the designer, run the update, resave the forms, and clear the browser's cache (or try Incognito mode) - let me know how it goes!

1 Like

@Nikita_Kurguzov well done! Seems to be fixed!
Thank you very much!

1 Like