Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Mapping between multiselect fields

(0) ShareShare
ReportReport
Posted on by 55

Hi,

I am currently stuck with the below issue.

I have two forms 'A' and 'B'.

Both has a different multiselect field on each form.

Question: Is it possible to populate the second multiselect field (form B)  based on some value from multiselect field (form A).

Thanks.

  • LeoAlt Profile Picture
    LeoAlt 16,331 on at
    RE: Mapping between multiselect fields

    Hi partner,

    Yes, you could add more ifs according to your requirement in code.

    If my answer helped you, please mark my answer as verified so that we could help other users with similar issues.

    Regards,

    Leo

  • Sip Khann Profile Picture
    Sip Khann 55 on at
    RE: Mapping between multiselect fields

    Thanks leo zhang. That should be helpful after adding few 'ifs' as both multiselect fields has different values.

  • LeoAlt Profile Picture
    LeoAlt 16,331 on at
    RE: Mapping between multiselect fields

    Hi partner,

    Are the two forms in same entity or different entity?

    If the forms are from different entities and they are related with each other, you could use JS on form B to get the value of multiselect field on form A first and decide what to do on your form B.

    Let's say form A in entity A and form B in entity B, then entity A should has an N:1 relationship with entity B which means entity A should be parent entity.

    Here's the sample code.

    //get field value based on lookup field.
    function getValueByCustomer(executionContext){
        formContext=executionContext.getFormContext();
        var customer=formContext.getAttribute("customerid").getValue();
        if(customer != null){
            var customerId = customer[0].id.replace("{", "").replace("}", "");
            //get field value from related account 
            Xrm.WebApi.retrieveRecord("account", customerId, "?$select=fieldname").then(
                function success(result) {
                    //set value from account form to order form
                    formContext.getAttribute('new_fieldName').setValue(result.fieldname);
                },
                function (error) {
                    console.log(error.message);
                    // handle error conditions
                }
            );
        }
    
    }

    Best Regards,

    Leo

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans