Tip #1109: Add variables to your workflow (when Actions don’t work)

Back in Tip #736: Add variables to your workflows, George ‘bringing discipline to the rest of us’ Doubinski suggested the excellent Tip of using an Action to simulate a variable in Workflows. I went to use this Tip this week for a lookup and, to my chagrin, found there is an exception to the Tip. Namely, if the output argument is a Lookup (or Option Set), the Action will NOT be available to the Workflow. It simply does not appear in the list. If you have a friendly developer nearby they can create a ‘wrapper’ with a custom Workflow activity but, as my colleague Lachlan ‘Cabin Boy’ Wright pointed out there is a simpler, codeless way. Sometimes the obvious answers come to us through the eyes of the innocent.

While it is possible to define an Input or Output argument as an EntityReference or Entity (think pointer or memory reference if you come from a C background, or GUID vs record, although for the simple purposes of configured Actions I am yet to find a practical difference between the two argument types), this renders the Action useless for the reason mentioned above. The alternative is to use the Workflow’s record, that is, the record the Workflow is running in the context of. So, if you need a lookup ‘variable’, create a lookup in the entity and store the value there. Workflows can be a bit tricky in terms of running their steps in order so be careful but it is a simple workaround to an annoying problem.

5 thoughts on “Tip #1109: Add variables to your workflow (when Actions don’t work)

  1. Aung Khaing says:

    Complex type arguments (Entity, EntityReference) have no longer issues in v9.0.


    Custom actions that return EntityReference, Entity, or EntityCollection types are available.

    • Aung,

      that’s true for Web API. What we were discussing is visibility of custom actions within the workflow. There is no UI available to handle these types of arguments and therefore these custom actions are not available in the workflow UI.


  2. Why am I a cabin boy? I prefer the term ‘upward delegator’

Leave a Reply

Your email address will not be published. Required fields are marked *