We have CRM on-premise installed on Local Network.
I wanna change state
and statusreason
of salesorder
( Order
entity ).
I saw this link.
And I call the function in this way ( change status to Canceled
and statusreason to No Money
:
var recordGuid = Xrm.Page.data.entity.getId();
setRecordStatus ("salesorder", recordGuid ,"3", "100001");
But it gives me 400 Bad Request Error ! Could any one help me on this?
You have to use CancelSalesOrderRequest
message to achieve this. Javascript SOAP request Code sample can be found in SDK.SAMPLES.CancelSalesOrderRequest
statecode 2 : Canceled
is having only valid associated statusreason 4 : No Money
Your code shows 3 : Fulfilled
& 100001 : Complete
combination. Check it.
Update:
The link you are referring works for most of the CRM entities, but it’s meant for straight forward status changes like Active to Inactive. But special entities like salesorder
needs special messages as this status changes involves other background platform activities like updating child salesorderdetail
entities.
You can refer this thread also.