Hi
I'm trying to this sample example in order to understand about actions with Ribbon button as plugin in JS. I had checked all steps and did in same way but not getting result. I would appreciate very much if anyone can tell me where it went wrong?
Article : - http://www.plusconsulting.com/Blogs/Lists/Posts/Post.aspx?ID=56
Process (Action) in my system
Custom button on phonecall entity
Source code - new_custom1.js
function ExecuteAction(entityId, entityName, requestName) { // Creating the request XML for calling the Action var requestXML = "" requestXML += "<s:envelope xmlns:s="\"schemas.xmlsoap.org/.../envelope\"">"; requestXML += " <s:body>"; requestXML += " <execute xmlns="\"schemas.microsoft.com/.../Services\"" xmlns:i="\"www.w3.org/.../XMLSchema-instance\"">"; requestXML += " <request xmlns:a="\"schemas.microsoft.com/.../Contracts\"">"; requestXML += " <a:parameters xmlns:b="\"schemas.datacontract.org/.../System.Collections.Generic\"">"; requestXML += " <a:keyvaluepairofstringanytype>"; requestXML += " <b:key>Target</b:key>"; requestXML += " <b:value i:type="\"a:EntityReference\"">"; requestXML += " <a:id>" + entityId + "</a:id>"; requestXML += " <a:logicalname>" + entityName + "</a:logicalname>"; requestXML += " <a:name i:nil="\"true\"">"; requestXML += " </a:name></b:value>"; requestXML += " </a:keyvaluepairofstringanytype>"; requestXML += " </a:parameters>"; requestXML += " <a:requestid i:nil="\"true\"">"; requestXML += " <a:requestname>" + requestName + "</a:requestname>"; requestXML += " </a:requestid></request>"; requestXML += " </execute>"; requestXML += " </s:body>"; requestXML += "</s:envelope>"; var req = new XMLHttpRequest(); req.open("POST", GetClientUrl(), false) req.setRequestHeader("Accept", "application/xml, text/xml, */*"); req.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); req.setRequestHeader("SOAPAction", "schemas.microsoft.com/.../Execute"); req.send(requestXML); //Get the Response from the CRM Execute method //var response = req.responseXML.xml; } function GetClientUrl() { if (typeof Xrm.Page.context == "object") { clientUrl = Xrm.Page.context.getClientUrl(); } var ServicePath = "/XRMServices/2011/Organization.svc/web"; return clientUrl + ServicePath; } function openPhoneCall() { var entityId = Xrm.Page.data.entity.getId(); var entityName = "phonecall"; var requestName = "new_ReactivePhoneCall"; ExecuteAction(entityId, entityName, requestName); window.location.reload(true); }
Results :-
when I click on reactivate button , nothing happens. I wonder why?