I have a flow from which I want to call an apexclass and retrieve a list of picklistvalues so a user can select from these in a flowscreen. How do I achieve this. I tried the code below but when I use the apex action type in the flow I do not get the variable "lstCancelOptions"
Apex
public class getCancelOptionsCurrentUser {
@InvocableMethod(label = 'Get cancel options current user' description = 'Get amendment Cancel reasons')
public static List<String> getCancelOptionsMsPicklist() {
String CancelOptions;
List<String> lstCancelOptions = new List<String>();
Id CurrUser = UserInfo.getUserId();
try {
CancelOptions = [SELECT Id, Reasons_Cancel__c from User where Id = :UserInfo.getUserId()].get(0).Reasons_Cancel__c;
} Catch(Exception e) {
System.debug('Error Canceloptions current user: ' + e.getMessage());
}
if (String.isNotBlank(CancelOptions)) lstCancelOptions = CancelOptions.split(';');
return lstCancelOptions;
}
}