There are times that we need to access and use data in CRM that we don’t want the users to see. For example we might want to make sure a Contact entity item enters a particular Workflow only once. This can be a tricky proposition when you have Contacts that need to be in Workflow both from the Create action and the Assign action. Utilizing a hidden field in CRM will be our method.
First off, let’s understand the concept of hidden fields. We can add an attribute to an entity and never add that attribute to the form. That in essence is a hidden field. Depending on our usage, we might also make the field Unsearchable. If we don’t then the field appears in the Advanced Find view and we may not want our users to see the data in this hidden field.
Let’s assume our custom, hidden attribute is named “InWorkflow”.
We now have a field that will hold the info we require. In this example we’re discussing how to utilize this field for Workflow. Since our Contact entity has the same rule set for Contacts that are created and assigned, we’ll set up 3 Workflow rules:
- On Create – Call the Manual Rule
- On Assign – Call the Manual Rule
- The Manual Rule – The rule that holds all our logic
It’s possible that a Contact might enter this Workflow more than once and that’s what we’re trying to avoid. In the Manual Rule we’ll use the Check Entity Condition & we’ll check the status of “InWorkflow”.
- If the status is Yes, then we choose the action Stop. We do this because we know the Contact is already in this Workflow rule.
- If the status is No or Null, then we Update the Entity to set “InWorkflow” to Yes.
Now we continue about the Workflow, adding our conditions and actions. If at any point we need the Contact to leave Workflow, make sure you Update the Entity to mark the “InWorkflow” to No.
As Microsoft CRM consultants, we are usually called upon to come up with a solution to a tricky problem. Our customers love it when we come up with creative solutions to what first seemed an impossible task.