Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to add a button to a form (not to a ribbon)

(0) ShareShare
ReportReport
Posted on by 645

Hi, I was asked to add a button to my form near a field (not on the ribbon) can I do it in a supported way ? the button after clicked will call a function that will get data from server side (if that's matters)

thanks

  • Suggested answer
    RE: How to add a button to a form (not to a ribbon)

    Hi Partner,

    you can use the Web resource to achieve this and create a button on the Form, reference link: community.dynamics.com/.../adding-a-button-to-a-form

  • Suggested answer
    gdas Profile Picture
    gdas 50,089 on at
    RE: How to add a button to a form (not to a ribbon)

    As describe above go with HTML web resources to create the button, you can implement your service side logic in plugin. Call the plugin from CRM action , on button click you can call Action directly.

    Another way to create Rest Services and or use Web API if you are trying to fetch CRM records.

  • Suggested answer
    mobeenmohsin Profile Picture
    mobeenmohsin on at
    RE: How to add a button to a form (not to a ribbon)

    Hi Sahara,

    Hope you are doing well.

    We can add button on any form using web resource (HTML page), please follow the below steps:

    1. Navigate to Settings > Solutions > Customize the solution.

    2. Click on web resources and add new HTML web resource.

    3. Put your HTML code with button and JavaScript. Save and publish.

    4. Go to edit form and Insert web resource created above.

    We can also use https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/query-data-web-api to get data from server. Use below code to call web api. 

    var req = new XMLHttpRequest();

    req.open("PATCH", Xrm.Page.context.getClientUrl() + "/api/data/v9.1/contacts(" + contactId + ")", true);

    req.setRequestHeader("OData-MaxVersion", "4.0");

    req.setRequestHeader("OData-Version", "4.0");

    req.setRequestHeader("Accept", "application/json");

    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");

    req.onreadystatechange = function() {

       if (this.readyState === 4) {

           req.onreadystatechange = null;

           if (this.status === 204) {

               //Success - No Return Data - Do Something

           } else {

               Xrm.Utility.alertDialog(this.statusText);

           }

       }

    };

    req.send(JSON.stringify(entity));

    }

    Best Regards,

    Mobeen Mohsin

    Dynamics CRM Consultant 

  • Verified answer
    Naveen Ganeshe Profile Picture
    Naveen Ganeshe 3,393 User Group Leader on at
    RE: How to add a button to a form (not to a ribbon)

    Hi,

    You can achieve this by creating a custom button in WebResource and after that, you can add the WebResource to the form. Please follow the below blogs to achieve the same:

    https://mscrmtutorials.com/create-a-custom-html-button-in-dynamics-365/

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/257055/adding-a-button-to-a-form?pifragment-97030=1#responses

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…

Vahid Ghafarpour – Community Spotlight

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

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,289 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans