web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Internal Server Error

(0) ShareShare
ReportReport
Posted on by 105

Whenever I click on the ribbon button, I am trying to update the the record in the sub grid.

I have used the below code to change the statecode and statusreason..

var request = "<s:Envelope xmlns:s=\"schemas.xmlsoap.org/.../envelope\">";
request += "<s:Body>";
request += "<Execute xmlns=\"schemas.microsoft.com/.../Services\" xmlns:i=\"www.w3.org/.../XMLSchema-instance\">";
request += "<request i:type=\"b:SetStateRequest\" xmlns:a=\"schemas.microsoft.com/.../Contracts\" xmlns:b=\"schemas.microsoft.com/.../Contracts\">";
request += "<a:Parameters xmlns:c=\"schemas.datacontract.org/.../System.Collections.Generic\">";
request += "<a:KeyValuePairOfstringanyType>";
request += "<c:key>EntityMoniker</c:key>";
request += "<c:value i:type=\"a:EntityReference\">";
request += "<a:Id>" + RECORD_ID + "</a:Id>";
request += "<a:LogicalName>" + EntityLogicalName + "</a:LogicalName>";
request += "<a:Name i:nil=\"true\" />";
request += "</c:value>";
request += "</a:KeyValuePairOfstringanyType>";
request += "<a:KeyValuePairOfstringanyType>";
request += "<c:key>State</c:key>";
request += "<c:value i:type=\"a:OptionSetValue\">";
request += "<a:Value>" + stateCode + "</a:Value>";
request += "</c:value>";
request += "</a:KeyValuePairOfstringanyType>";
request += "<a:KeyValuePairOfstringanyType>";
request += "<c:key>Status</c:key>";
request += "<c:value i:type=\"a:OptionSetValue\">";
request += "<a:Value>" + statusCode + "</a:Value>";
request += "</c:value>";
request += "</a:KeyValuePairOfstringanyType>";
request += "</a:Parameters>";
request += "<a:RequestId i:nil=\"true\" />";
request += "<a:RequestName>SetState</a:RequestName>";
request += "</request>";
request += "</Execute>";
request += "</s:Body>";
request += "</s:Envelope>";

//send set state request
$.ajax({
type: "POST",
contentType: "text/xml; charset=utf-8",
datatype: "xml",
url: Xrm.Page.context.getClientUrl() + "/XRMServices/2011/Organization.svc/web",
data: request,
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/xml, text/xml, */*");
XMLHttpRequest.setRequestHeader("SOAPAction", "schemas.microsoft.com/.../Execute");
},
success: function (data, textStatus, XmlHttpRequest) {
window.location.reload(true);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(errorThrown);
}
});

Please help me...

thanks.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    tw0sh3ds Profile Picture
    5,600 on at
    RE: Internal Server Error

    First of all probably you get more information than that, your browser simply displays Internal Server Error because it got 500 from the server. Open your browser's developer tools and on networking tab open your request/response and look for more descriptive error message. If that does not help, turn on server tracing and check the error in server logs. it should be much clearer there.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#2
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans