When I am trying to pass records prepared into an Invocable Apex method from a flow that have had picklist values set on the record I receive the following error message.
An Apex error occurred: System.DmlException: Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Picklist Field: value not of required type: Value Set From Flow: Picklist Field
Then I came across the following known Salesforce issue which states there is no workaround - https://success.salesforce.com/issues_view?id=a1p3A0000003fH1QAI
In an effort to find a workaround I first tried casting the field as a String but got the following error.
An Apex error occurred: System.TypeException: Invalid conversion from runtime type java:moduleapi.interaction.FlowPicklistValue to String
I then tried JSON serialising and deserialising but then got the following error on deserialising (even untyped)
An Apex error occurred: System.JSONException: Type unsupported in JSON: moduleapi.interaction.FlowPicklistValue
Seems like there's a special internal type for Flow picklists that doesn't behave well in Apex. Was wondering if there were any ideas to solve this? Or accept that there is no workaround.