Answered by:
Deactivation Status Reason OnSave

Question
-
When deactivating a custom entity record, I know how to get whether the record is being closed or not (event.Mode), however I am not sure how to get the status reason for why it is being closed. I need certain functions to run based on why it was closed (canceled, rejected, etc).Any help would be appreciated,ThanksBrian ReidThursday, November 19, 2009 4:32 PM
Answers
-
Figured it out, it is document.getElementById('newStatusCode').value
- Marked as answer by Brian J Reid Thursday, November 19, 2009 8:33 PM
Thursday, November 19, 2009 8:33 PM
All replies
-
Brian,
You can usually find this information in the CRM database. An activated record will have a StateCode value of 0, and a deactivated record record will have a StateCode of 1. Further, you can usually tell the reason for the deactivation on certain types of records based on the StatusCode. StatusCode is unique per type of record. I'm not 100% sure how it works for Custom entities.
But I know for example with Opportunities you can tell the reason an Opportunity is closed based on its StateCode and StatusCode (closed as "Won", or closed as "lost", reason "Sold out", etc"
http://technet.microsoft.com/en-us/library/ms914670.aspx
See the above link for out of box entities' State and StatusCodes and if you are familiar with querying the database maybe you can infer the reasons for the deactivations based on your custom entities' status codes. Good luckThursday, November 19, 2009 5:18 PM -
First, you'll need to ensure that the list of values for the Attribute Status Reason have been updated for the status of 'Active' and 'Inactive'. Once that has been completed, add the Status Reason attribute to the form so users can select it before deactivating the record. You will then be able perform conditional actions against the value.
Best Regards, Donna- Proposed as answer by Donna EdwardsMVP Thursday, November 19, 2009 5:41 PM
Thursday, November 19, 2009 5:41 PM -
Resources for IT Professionals > Dynamics Forums > CRM > Deactivation Status Reason OnSave > 51fb55bb-6545-4d63-9747-78f5f72df364Thursday, November 19, 2009 5:58 PM
-
Figured it out, it is document.getElementById('newStatusCode').value
- Marked as answer by Brian J Reid Thursday, November 19, 2009 8:33 PM
Thursday, November 19, 2009 8:33 PM