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)

Need to add button in ribbon

(0) 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

I have the same question (0)
  • Suggested answer
    T.I.A Profile Picture
    1,760 on at

    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

  • Community Member Profile Picture
    on at

    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

    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

           }));

    }

  • Suggested answer
    Ammar Zaied Profile Picture
    1,670 on at

    Hi,

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

  • Community Member Profile Picture
    on at

    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

  • T.I.A Profile Picture
    1,760 on at

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

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