Example of calling Global Action Without Parameters:
Create a Global Action
Add Steps and Copy Action Unique Name (My Custom Action)
JavaScript to call Action
//Execute the created global action using Web API.
function CallGlobalCustomAction() {
//get the current organization name
var serverURL = Xrm.Page.context.getClientUrl();
//query to send the request to the global Action
var actionName = \"new_MyCustomAction\"; // Global Action Unique Name
//Pass the input parameters of action
var data = {};
//Create the HttpRequestObject to send WEB API Request
var req = new XMLHttpRequest();
//Post the WEB API Request
req.open(\"POST\", serverURL + \"/api/data/v8.0/\" + actionName, true);
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 == 200 || this.status == 204)
{
alert(\"Action Executed Successfully...\");
}
else
{
var error = JSON.parse(this.response).error;
alert(\"Error in Action: \"+error.message);
}
}
};
//Execute request passing the input parameter of the action
req.send(window.JSON.stringify(data));
}
Example of calling Global Action with Parameters:
JavaScript to call Action
//Execute the created global action using Web API.
function CallGlobalCustomAction() {
//get the current organization name
var serverURL = Xrm.Page.context.getClientUrl();
//query to send the request to the global Action
var actionName = \"new_MyCustomAction\"; // Global Action Unique Name//set the current loggedin userid in to _inputParameter of the
var InputParameterValue = Xrm.Page.context.getUserId();
//Pass the input parameters of action
var data = {
\"MyInputParameter\": InputParameterValue
};//Create the HttpRequestObject to send WEB API Request var req = new XMLHttpRequest(); //Post the WEB API Request req.open(\"POST\", serverURL + \"/api/data/v8.0/\" + actionName, true); 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 == 200 || this.status == 204) { alert(\"Action Executed Successfully...\");
//You can get the output parameter of the action with name as given belowresult = JSON.parse(this.response);
alert(result.MyOutputParameter);} else { var error = JSON.parse(this.response).error; alert(\"Error in Action: \"+error.message); } } }; //Execute request passing the input parameter of the action req.send(window.JSON.stringify(data)); }
It’s interesting to read content. nice post.Microsoft Dynamics AX Online Training
LikeLike
Thanks For Sharing The Information The Information Shared Is Very Valuable Please Keep Updating Us Time Just Went On Reading The article Python Online Course Hadoop Online Course Aws Online Course Data Science Online Course
LikeLike
Thank you for sharing the article. The data that you provided in the blog is informative and effective. Best Devops Training Institute
LikeLike
Thank your valuable content.we are very thankful to you.one of the recommended blog.which is very useful to new learners and professionals.content is very useful for hadoop learnersBest ASP.NET MVC Online Training InstituteBest Spring Online Training InstituteBest Devops Online Training Institute Best Datascience Online Training Institute Best Oracle Online Training Institute Best AWS Online Training Institute Best AngularJS Online Training Institute
LikeLike
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website angular js online trainingbest angular js online trainingtop angular js online training
LikeLike
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website angular js online training
LikeLike
I like your post very much. It is very much useful for my research. I hope you to share more info about this. Keep posting angular trainingruby on rails online courseai online trainingQlikview TrainingSpark Training
LikeLike
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website workday studio online trainingbest workday studio online trainingtop workday studio online training
LikeLike
Your information was very clear. Thank you for sharing.D365 Finance and Operations Online Training
LikeLike
Great post.It seems to be interesting and gave me lot of information,Thank for sharing it.I am looking forward for new articles.keep it up.Website Development Company in Bangalore | Website Design Company in Bangalore | Mobile App Development Companies in Bangalore | Game Development Companies in Bangalore
LikeLike
Great post with unique information.This blog will really helpful for me to develop my skills in a right way.Thanks for sharing,keep update with your blogs. Website Design Company in Bangalore | Mobile App Development Companies in Bangalore | Website Development Company in Bangalore
LikeLike
It was really a nice post and I was really impressed by reading this keep updating React js Online Training Angularjs Training NodeJS Online Training Hyderabad Microstrategy Online Training Power BI Online Training Hyderabad AngularJS Online Training
LikeLike
Excellent information with unique content and it is very useful to know about the information based on blogs . Website Development Company in Bangalore | Web Designing Companies in Bangalore | Web Development Company in Bangalore Zinavo Technologies Blog : Website Designing Company in Bangalore | Web Designing Company in Bangalore
LikeLike
I believe that your blog will surely help the readers who are really in need of this vital piece of information. Waiting for your updates AWS training in chennai | AWS training in annanagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery
LikeLike
Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Salesforce Training in ChennaiSalesforce Online Training in ChennaiSalesforce Training in BangaloreSalesforce Training in HyderabadSalesforce training in ameerpet Salesforce Training in PuneSalesforce Online TrainingSalesforce Training
LikeLike
Informative Article…
LikeLike
Fake Bank StatementFake Bank StatementFake Bank StatementFake Bank StatementFake Bank StatementFake Bank StatementFake Bank StatementFake Bank Statement
LikeLike
Fake Bank StatementFake Bank StatementFake Bank StatementFake Bank StatementFake Bank StatementFake Bank StatementFake Bank StatementFake Bank Statement
LikeLike
Great Article Cloud Computing Projects Networking Projects Final Year Projects for CSE JavaScript Training in Chennai JavaScript Training in Chennai The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training
LikeLike
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my websiteangular js online trainingbest angular js online trainingtop angular js online training
LikeLike
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my websiteangular js online trainingbest angular js online trainingtop angular js online training
LikeLike
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my websitedevops online trainingbest devops online trainingtop devops online training
LikeLike
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my websiteangular js online trainingbest angular js online trainingtop angular js online training
LikeLike
Sometime few educational blogs become very helpful while getting relevant and new information related to your targeted area. As I found this blog and appreciate the information delivered to my database.How to get rid of Discord Javascript Error | newscutzy.com
LikeLike
Nothing remain forever. Then why to keep same patter of work again and again. Why to repeat same strategy for very essay. Use differ strategy for different subjects because every subject has its own meaning. Keep such posts on.Discord Javascript Error
LikeLike
very good post, i actually love this web site, carry on itdata science training python trainingangular js training selenium trainings
LikeLike
Special thanks to (hackingsetting50@gmail.com) for exposing my cheating husband. Right with me i got a lot of evidences and proofs that shows that my husband is a fuck boy and as well a cheater ranging from his text messages, call logs, whats-app messages, deleted messages and many more, All thanks to (hackingsetting50@gmail.com), if not for him i will never know what has been going on for a long time. Contact him now and thank me later.
LikeLike
Special thanks to (hackingsetting50@gmail.com) for exposing my cheating husband. Right with me i got a lot of evidences and proofs that shows that my husband is a fuck boy and as well a cheater ranging from his text messages, call logs, whats-app messages, deleted messages and many more, All thanks to (hackingsetting50@gmail.com), if not for him i will never know what has been going on for a long time. Contact him now and thank me later.
LikeLike