One of of my colleagues came across an interesting scenario when trying to re-activate an activity. Out of the box CRM does not include a “re-open” or “re-activate” button on activity records.
We could write some code to add an “activate” button onto activity entity forms so when a user presses it the activity is re-opened. An alternative is to create a workflow to run on-demand that re-opens the record.
Whilst investigating the above she stumbled across an interesting blog which shall remain unnamed.
This works but the first worry that comes to mind is – How is this affecting the database?
Having created a test appointment in CRM, the system sets in SQL the statecode to 3 (Scheduled) and the statuscode to 5 (Busy) on creation.
If we close the appointment as “Completed”, the system sets the statecode to 1 (Completed) and the statuscode to 3 (Completed) on update.
If we then re-open the appointment using the script above, the system sets the statecode to 0 (Open) and the statuscode to 1 (Free) on update.
Finally if we then close the appointment again as “completed”, the system sets the statecode to 1 (Completed) and the statuscode to 3 (Completed) on update.
Stick to using the supported functionality such as workflows to prevent stumbling across potential data corruption in CRM unless you are feeling very confident!