Hi there all
Im gonna try to change the state and statusreason.I saw a link and find that useful.
But when I use that It gives me Bad Request Error.How can I solve this?Im doing it in salesorder entity and wanna change state value to 3( canceled) and statusreason to 4, so call that in this way :
var recordGuid = Xrm.Page.data.entity.getId();
setRecordStatus ("salesorder", recordGuid ,"3", "100001");
Where I am doing wrong?
Is 100001 a custom status reason that you created for your Organization?
I'd get a Fiddler + a CRM Platform trace (if On Premise) and try to get more details on the exception.
Hope this helps,
Hi there sir, I changed the request string and now it gives me 500 internal server error, I installed fiddler and saw 401, unauthorized before internal server error.
I never try that code, but usually if I need to have function for that one. I used third party library like XrmServiceToolkit. You just to add the library on the form.
Use this -
Guid EntityID = new Guid("Entity ID");
SetStateRequest request = new SetStateRequest
EntityMoniker = new EntityReference("EntityName", EntityID),
State = new OptionSetValue(2),
Status = new OptionSetValue(3)
I have CRM 2011 on-permise :-)
Now it gives me error 500 inernal state, I have edited the question and post the fiddler output.
Can you please also collect a CRM Platform trace and paste here the exception with the call stack?
My purpose by this post was to change status and statusreason that i did that via this question,
I found my answer and I did reply that.
Here is the link :
Business Applications communities