Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Suggested answer

How to pass multiselect option set values to Quick Create form using Xrm.Navigation.openForm

Posted on by 247

Hello,

I am looking for a solution in which I want to open a Quick Create form on click of Ribbon Button and on open of Quick Create form I want that some values from the parent record should get mapped to the Quick Create form.

In this all fields mapped successfully except the Multi Option Set field. This field is having 10 options out of which 3 options are selected and the same I want on the Quick Create form of other entity.

Remember I have retrieved a record from the preveious entity using Xrm.WebApi.retrieveRecord and its retrieved data I have in result as follows:

var abc= result["cs_abctype"];

I need to set the same option set values to Quick Create form through
Xrm.Navigation.openForm(entityOptions, formParameters)

Thanks

AR

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 5,864 Moderator on at
    RE: How to pass multiselect option set values to Quick Create form using Xrm.Navigation.openForm

    Hello AR ,

    Please refer below thread where I have already provided the solution for your requirement. And for the Multiselect option set please refer below code.

        

    function setField()
    {
        var entityFormOptions = {};
        entityFormOptions["entityName"] = "contact";
        entityFormOptions["useQuickCreateForm"] = true;
    
        optionsetValues = [821220000,821220001,821220004]; // declare an arry and provide the optionset values
        
        // Set default values for the Contact form
        var formParameters = {};
        formParameters["firstname"] = "Sample";
        formParameters["lastname"] = "Contact";
        formParameters["fullname"] = "Sample Contact";
        formParameters["emailaddress1"] = "contact@adventure-works.com";
        formParameters["jobtitle"] = "Sr. Marketing Manager";
        formParameters["donotemail"] = "1";
        formParameters["description"] = "Default values for this record were set programmatically.";
        
        formParameters["ak_multiselect"] = optionsetValues; // Optionset value set
    
        // Open the form.
        Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
            function (success) {
                console.log(success);
            },
            function (error) {
                console.log(error);
            });
    }

    Add option set value in an array. and pass it to the field.

    pastedimage1654511044951v1.png

    Output : 

    pastedimage1654511156338v2.png

    pastedimage1654511203334v3.png

    Thank you,

    Amit Katariya

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to pass multiselect option set values to Quick Create form using Xrm.Navigation.openForm

    Hi AR,

    This should be a bug. I tested this before and all type fields could be pre set successfully besides multi-select option.  You would better raise a ticket to feedback this.

    Set field values using parameters passed to a form (Developer Guide for Dynamics 365 Customer Engagement) | Microsoft Docs

  • ARTECH Profile Picture
    ARTECH 247 on at
    How to pass multiselect option set values to Quick Create form using Xrm.Navigation.openForm

    Hello,

    I am looking for a solution in which I want to open a Quick Create form on click of Ribbon Button and on open of Quick Create form I want that some values from the parent record should get mapped to the Quick Create form.

    In this all fields mapped successfully except the Multi Option Set field. This field is having 10 options out of which 3 options are selected and the same I want on the Quick Create form of other entity.

    Remember I have retrieved a record from the preveious entity using Xrm.WebApi.retrieveRecord and its retrieved data I have in result as follows:

    var abc= result["cs_abctype"];

    I need to set the same option set values to Quick Create form through
    Xrm.Navigation.openForm(entityOptions, formParameters)

    Thanks

    AR

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,537 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,520 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans