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)

keep getting error when javascript calls action

(0) ShareShare
ReportReport
Posted on by 2,510

Hi, I am trying to invoke action through javascript, but I keep getting this error, it looks like my input parameter doesn't get the parameter value from javascript, not what else I have missed,

5224.2017_2D00_11_2D00_16_5F00_1633.png

5224.2017_2D00_11_2D00_16_5F00_16333.png

function executeAction(){
	debugger;
    var parameters ={
    	"ApplicationRef": "8B446743-C6C4-E711-A81C-005056B5FEFA",
    	"Amount": "590",
    	"Authcode": "AuthCode5"
    };

    var req = new XMLHttpRequest();
        req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/recoserv_ACT101_Payment_MarkAsPaid", 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 === 200) {
                  var results = JSON.parse(this.response);
                  Xrm.Utility.alertDialog(results.message);
                  alert("successful");
             } else {
                  var error = JSON.parse(this.response).error;
                  Xrm.Utility.alertDialog(error.message);
         }
    }
};
req.send(JSON.stringify(parameters));
//req.send();
}


*This post is locked for comments

I have the same question (0)
  • Verified answer
    TomSmelser Profile Picture
    1,570 on at

    Maybe try calling stringify and setting a variable before the send. Then pass the variable instead.

    Not sure it would make much difference but worth a try.

    Good luck!

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