Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

Multi-select form field submission behavior

(0) ShareShare
ReportReport
Posted on by 15

Hello,

I need to include a multi-select field on Marketing form (Landing page form type) as a hidden pre-filled check-box, however, I need to achieve that if the Contact is already existing in the CRM database with a different value for this multi-select field, that value doesn't get over-written, but the pre-filled value get's added to the multi-select field on the Contact record.

So if on a Contact record I have multi-select field that specifies my contact type, which can be Type A, Type B or both, and I have a Contact which is classified within the system as Type A, but that contact submits a form for Type B Contact, after that form submission, the Contact is classified as Type A and Type B Contact, so the Type B hidden pre-filled value gets added to the contact type field and does not over-write the previously chosen Type A value.

How can one achieve that?

Thank you very much for your time and answer in advance.

All the best,

Marianna

  • Suggested answer
    RodRodriguez Profile Picture
    RodRodriguez on at
    RE: Multi-select form field submission behavior

    This is something you could do with a JavaScript.

    To get you started, this is a JavaScript I have that will hide or show a separate field based on the value in a MultiOptionSet field.  Should be easy enough to modify to your needs by putting in some logic:

    function multiOptionSetHideOrShowField(executionContext)

    {

    var formContext = executionContext.getFormContext();

           var fieldObj = formContext.getControl("fax")

    var multiOptionSetFieldValues = formContext.getAttribute('new_multioptionset').getValue();

     if (multiOptionSetFieldValues == null)

     {

       fieldObj.setVisible(false);

     }

     else

     {

       if(multiOptionSetFieldValues.includes(2)) //When user will select multiple options and 'other'(value 2) is one of them

       {

         fieldObj.setVisible(true); //Specify true to show the field; false to hide the field.            

       }

       else

       {

         fieldObj.setVisible(false);

       }

     }

    }

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

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,969 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,842 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans