I have two Autolaunched flows in my org with the same API Name. The API Name is Account_Record_Criteria_Evaluator
. One flow belongs to a managed package and another exists in my org. I want to call both flows from my Apex code using below scripts.
(Org Flow) Calling below code works:
String recordId = '001XXXXXX';
String objectApiName = 'Account';
Map<String, Object> inputs = new Map<String, Object>();
inputs.put('recordId', recordId);
inputs.put('objectApiName', objectApiName);
Flow.Interview criteriaFlow = Flow.Interview.createInterview('Account_Record_Criteria_Evaluator', inputs);
criteriaFlow.start();
(Managed Package Flow) Calling below code gives System.TypeExceptions:
String recordId = '001XXXXXX';
String objectApiName = 'Account';
Map<String, Object> inputs = new Map<String, Object>();
inputs.put('recordId', recordId);
inputs.put('objectApiName', objectApiName);
Flow.Interview criteriaFlow = Flow.Interview.createInterview('pcp__Account_Record_Criteria_Evaluator', inputs);
criteriaFlow.start();
Since both flows has same API names but different namespace, how can I call these Autolaunched flows from Apex code.