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.
Complex type arguments (Entity, EntityReference) have no longer issues in v9.0.
Custom actions that return EntityReference, Entity, or EntityCollection types are available.
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.
Because of the enhancement in Web API, v9.0 has addressed the issue in the workflow. However, there is still a limitation that we cannot have two output arguments referencing to the same entity type.
For instance, you cannot create two output parameters referencing to the Team entity and the workflow will not display the action. But, you can have two output parameters referencing to Team and User, and the workflow will show the action. Prior to v9.0, it was not possible to have a single complex parameter.
Is it the document you are referring to?
Why am I a cabin boy? I prefer the term ‘upward delegator’