Notifications
Announcements
No record found.
Hi All,
I'm trying to change the Status Reason on Service Activity onchange of startdate field. Does any know hot to change it using the javascript. Thanks in advance.
Drew
*This post is locked for comments
Have you tried something like this:
http://mileyja.blogspot.co.uk/2011/07/set-status-or-state-of-record-using.html
mscrmdeveloper.wordpress.com/.../update-status-reason-using-javascript
You should be able to use below code to set status reason of an service activity
Xrm.Page.getAttribute("statuscode").setValue(integervalue of statusreason );
Integer - Status reason
1 - Requested
2 - Tentative
3 - Pending
4 - Reserved
6 - In Progress
7 - Arrived
I would use the SetState: A JavaScript Function to perform a set state soap request, and is the right option to take, even from server side, if i need to change the status i would use the setstate request, and in javascript you can use either sopa or rest. In the SDK you will find how to do.
Chitrarasan Duraisamy - I read somewhere you cant set it this way, however I tried after you suggested it. It works like a charm
Thanks everyone.
You can use javascript to do it but before using javascript you will have to save the activity and then update Status field using JavaScript. I was also having same issue in PhoneCall entity and then I tried so many articles .
try something like this -
blog.infobitsoft.com/.../how-to-change-the-status-value-in-ms-dyanmics-365-using-javascript.html
Hello Drew Inc. and everybody, the answers posted here are following old approaches. After the D365 CE v9.0 has arrived, Microsoft has strongly suggested us to use XrmWebApi functions. In the following piece of JavaScript code, I am updating the status of a Case (incident) record to 'Waiting for Details' with the help of Xrm.WebApi.updateRecord method. Please consider. :)
function UpdateCaseStatus(executionContext)
{
var formContext = executionContext.getFormContext();
var entityId = formContext.data.entity.getId().substring(1, 37);
debugger;
var incidentData = {
"statecode": 0,
"statuscode": 3
};
Xrm.WebApi.updateRecord("incident", entityId, incidentData).then(function success(result)
formContext.data.refresh(true);
}, function (error)
});
}
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2