Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Need to add button in ribbon

(1) ShareShare
ReportReport
Posted on by

Hi Guys,

Thanks for your all previous informations and it will be very useful.

 I have created new entity called credit card application form and now I need to add approve button in ribbon and once I select the button the form status should changed to Approved and same for reject process.

I have added the button in ribbon but don't know how to add that functionality. Please guide me to do this.

Thanks & Regards,

Suresh K

*This post is locked for comments

  • T.I.A Profile Picture
    1,760 on at
    RE: Need to add button in ribbon

    These fields could be mandatory, try populating these fields then press your button and let's see what the outcome is

  • Community Member Profile Picture
    on at
    RE: Need to add button in ribbon

    Hi,

    I have followed as per the instruction and also the java script but I got an error like "You should specify a parent contact or account". our version id is 8.0.

    Could you tell me why the error is showing?

    Regards,

    Suresh K

  • Suggested answer
    Ammar Zaied Profile Picture
    1,670 on at
    RE: Need to add button in ribbon

    Hi,

    you must use the RibbonWorkBench : ribbonworkbench.uservoice.com/.../71374-1-getting-started-with-the-ribbon-workbench

  • Suggested answer
    T.I.A Profile Picture
    1,760 on at
    RE: Need to add button in ribbon

    So you have a button, for that button to be visible it needs a command.

    ribwr.PNG

    go to the command for your button (if you don't have one then create one). Then where I've put a 1, click add action and make sure you select JavaScript action. You're going to want a JavaScript function that you can reference from the ribbon workbench ( 2 = web resource where the JavaScript lives, 3 = function you want to use)

    function example() {

       debugger;

       //update

       var clientURL = Xrm.Page.context.getClientUrl();

       var recordId = Xrm.Page.data.entity.getId();

       var req = new XMLHttpRequest();

       req.open("PATCH", encodeURI(clientURL + "/api/data/v8.1/incidents(DC9E62A8-90DF-E311-9565-A45D36FC5FE8)", true)); //replace this guid with recordId

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

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

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

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

       req.onreadystatechange = function () {

           if (this.readyState == 4 /* complete */) {

               req.onreadystatechange = null;

               if (this.status == 204) {          

                   alert("success");

               }

               else {

                   var error = JSON.parse(this.response).error;              

                   alert(error.message);

               }

           }

       };

       req.send(JSON.stringify(

           {

               statecode: 0,

               statuscode: 1

           }));

    }

  • Community Member Profile Picture
    on at
    RE: Need to add button in ribbon

    Hi,

    I tried that one but it's not working. Can you share me the screenshot of this process along with the java script details.

    Thanks for understanding  

  • Suggested answer
    T.I.A Profile Picture
    1,760 on at
    RE: Need to add button in ribbon

    Go to the commands for your button in the  ribbon workbench and add a JavaScript action. Then you need to adapt similar code to this to change the status

    syednizamsyed.blogspot.com/.../change-record-status-through-webapi-in.html

    mscrmtechie.blogspot.com/.../change-record-status-using-javascript.html

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans