web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Customize Button to Pre-populate field

(0) ShareShare
ReportReport
Posted on by

This might be too complex, but in my environment I have Account Types and Contact Types, I would like to customize a button to automatically populate these fields.

For example, I have two types of contacts, one is known just as "contact" and the other one is "participant". I would like to have buttons called Add Participant and Add Contact to pre-populate the field Contact Type.

Is it possible to do that through the Ribbon Workbench?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    M I Mostafa Profile Picture
    4,257 on at

    Hi Lucas,

    You could create the two buttons so that they trigger a JavaScript function. You will have two versions of the same function to be fired based on which button is clicked. Every time either button is clicked, the relevant function will be executed to set the field value.

    Have a look at this example:

    stackoverflow.com/.../javascript-ms-dynamics-crm-2016-changing-value-of-option-set-field-using-conf

    You can add the buttons by editing the customisations ribbondiff xml easily.

    Hope this helps! Please click "yes" if you found this response helpful.

  • Community Member Profile Picture
    on at

    I see I can add the Java Script function to the button, but how do I add action to a button to call the function to create a new record (in this case a new contact) and pull up the right form and then populate the field (Contact Type)?

  • Verified answer
    ashlega Profile Picture
    34,477 on at

    Hi Lucas,

     have a look at the openEntityForm function - that's, likely, what you need:

    msdn.microsoft.com/.../jj602956.aspx

     If you pass null for the record id, it'll bring up a "create" form. You can pass formid through the parameters. And you can pass type value through the parameters as well.

     There are examples there, but it would look more or less like this:

    var parameters = {};

    parameters["formid"] = "<FORM ID>";

    parameters["new_contacttype"] = 100000000;

    Xrm.Utility.openEntityForm("contact", null, parameters);

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans