I thought I’d create a quick post as I was required to use a workaround for a client today involving an OnLoad event that wasn’t being called correctly in Microsoft Dynamics CRM 2013.
I remembered that a colleague had mentioned this in the past and advised that there was indeed a workaround using configuration, namely;
- 1 x Boolean field
- 1 x Synchronous Workflow
- Update to the fields OnChange event
So what do you do?
Step 1 – Create a new Boolean (Two Option) field for the entity or entities effected. In my client’s case it was Account, using the following steps; Settings > Solutions > Choose Your Solution and Open it > Entities > Account > Fields > New.
Then make sure you add a display name that will make sense to you, set the “Field Requirement” to “Optional” and set the “Type” option to “Two Options”, then click Save and Close.
Step 2 – Next add the new field to the required forms against your entity, then click “Change Properties” on your field and uncheck “Display Label on the Form” and “Visible by Default” and also check “Lock the Field on the Form” (this will endure admin’ users will have to think twice before removing the field) then click “OK” to close the box. Next click Save and then Publish your changes and close the form (still no button for Save, Publish and Close), repeat for other forms as required.
Step 3 – Create a new Synchronous Workflow (real-time) Process against the entity with “Organisation” as the scope (in this case Account) in CRM that is triggered when;
- Record is created
- Record status changes
- Record fields change (check the required fields to apply this workflow to)
Add a workflow step to update the entity (in this example Account) and in the “View Properties” area select the Boolean we just added and set the field value to “Yes”. Save and Activate the workflow.
Please Note; be careful to select the right option in the “execute as” property, if the owner of the workflow is the system admin’ account then you should have no issues, if it is the user who made the changes, then you will have to consider their security role for the entity.
Remember to add the function in minus “()”. Then click “OK” and Save, Publish and Close. Repeat as required for other forms.
Don’t’ forget to test your changes and you are done.