Multi-Select Picklist Gotcha!

While I have used muti-select picklist several times in the past and there is no confusion about it, recently, I ran into an issue which relates to a limitation which is very well documented and should not be a surprise but still I ended up spending some good amount of time getting to the bottom of the issue only because the error details provided no clue as to what the root cause is. This can happen sometimes especially when you are working on a system that was implemented by some other team (perhaps a different partner or client) and you are brought on the fly to implement some specific logic in the existing application.

I created a real-time workflow on the existing entity (since the scenario demanded that), added a Create step and did all the mappings to populate the fields.

I was able to save the the mapping screen without any error but still the workflow step had an error against it.

When I tried to activate the process, the only meaningful error description in the error log was this:

The selected workflow has errors and cannot be published. Please open the workflow, remove the errors and try again.

Generally if there are any mandatory fields, the workflow step expects you to populate it otherwise it gives you error and you cannot save the mapping form unless you map all mandatory fields as shown below.

In situations like this where the error message has insufficient details, the only option you have is to do some trial and error to find out the culprit and fix it. I did several attempts by deleting the step altogether, re-mapping all the fields but none of this fixed the error. I looked at the mapping form thoroughly to see if there are any fields (whether on the form or sitting at the bottom as unused) which needed my attention but I could not find anything and perhaps the absence of something was what took me time to troubleshoot. Note that at this point, I did not know that this entity had a multi-select field as well.

After I had tried everything, I started going through the meta data/field list of the entity to look at it from a different perspective and this time what caught my attention was this field which was a multi-select picklist. Having a multi-select field in that entity was not the problem, the problem was that it was set as mandatory as shown below and was also added to the main form.

It turns out that the multi-select picklist field is never available on the workflow (Create/Update) field-mapping screen regardless of whether it is mandatory or not. This is due to the fact that muti-select picklists are not supported in Worfklows as documented here. This was the reason that I could not pick this error easily by visually inspecting the mapping screen earlier because it never existed there.

Ideally, these limitations are something that you should know upfront and keep in mind at design time so you take appropriate approach to meet the requirements otherwise it could be a bit expensive change later.

In my situation, after discussing different approaches with the client, we agreed on making this field optional which allowed me to get rid of this error.

Some Observations

While doing troubleshooting, I did try a few other scenarios to understand the behaviour and here are my findings.

  • The WF error will only appear if (a) the multi-select field is mandatory as well as (b) it is added to the form. i.e. if the field is marked as mandatory in the meta data but was never added to the form, the WF does not throw this error and still allows you to activate the process.
  • This behaviour exists regardless of whether your multi-select Optionset is local or global.
  • As mentioned earlier, the Multi-Select field never appears in the workflow

What if I used Power Automate Flow?

Out of curiosity, I did try to implement similar logic using power automate flow and here is what I found:

  • CDS Connector

The CDS Connector which has been there for a long time now (i.e. without the option of selecting ‘current’ environment) did not surface the multi-select field in the Create/Update Record action.

  • CDS Connector (current environment)

The CDS Connector (current environment) did surface multi-select field on the Create/Update Record action, however, it did not show the list of available options that you would normally see in the form of a drop down for simple picklists. Nonetheless, I was able to populate the field by entering custom value for the OptionSet codes separated by comma as shown below and it successfully created/updated the record (or you could have done it dynamically as well).

Given that Multi-Select is not supported in Workflows, I think it would be great to see Microsoft updating this behaviour to display proper error message if someone tries to perform Create/Update step on an entity which happens to have a mandatory Multi-Select picklist field so that you immediately know what is causing the error. I am saying this because I believe real-time workflows are not going anywhere anytime soon. If you have a different view about RT WFs, I will be happy to learn further.

Leave a Reply

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