我更改了salesorder
实体,并在status reason
中创建了一个新的Submitted
。
我在状态status reason
中添加了一个名为PreTransport
的{{1}},其值为submitted
。
我可以通过以下请求从100000004
Active
(state
)到pending status reason
Submitted
(state
In-Progress
):>
status reason
但从 var request = ""
request += "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";
request += " <s:Body>";
request += " <Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";
request += " <request i:type=\"b:SetStateRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\" xmlns:b=\"http://schemas.microsoft.com/crm/2011/Contracts\">";
request += " <a:Parameters xmlns:c=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";
request += " <a:KeyValuePairOfstringanyType>";
request += " <c:key>EntityMoniker</c:key>";
request += " <c:value i:type=\"a:EntityReference\">";
request += " <a:Id>" +recordGuid+ "</a:Id>";
request += " <a:LogicalName>salesorder</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
var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() + "/XRMServices/2011/Organization.svc/web", true)
// Responses will return XML. It isn't possible to return JSON.
req.setRequestHeader("Accept", "application/xml, text/xml, */*");
req.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
req.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");
var successCallback = null;
var errorCallback = null;
req.send(request );
到In-Progress
的{{1}}到PreTransport
都无效。
我想是因为state
。我应该在这个新的permission
上设置权限吗?
如果是,我该怎么做? 请注意,我有CRM 2011内部部署。
注意:我也尝试过此代码,但没有成功。
status reason
答案 0 :(得分:0)
抱歉,我无权访问2011版本。但是我在CRM Rest builder的以下代码段中对此进行了测试,它可以完美运行。
我在status reason (StatusCode)
的{{1}}下创建了值100000000 : Shipping ready
的自定义status (StateCode)
。确保您正在经历允许的过渡,例如answered here。
1 : Submitted