0

Requirement : To invoke a flow through trigger when "object A" is inserted .

Trigger implemented so far :-

trigger CallMyFlow on Object A (after insert) {
String  objectAId;
List<Object A> objectA = new List<Object A>();
objectA = [Select Id,Account__c from Object A ];
Map<String, Object> params = new Map<String, Object>();
params.put('objectA', ObjectA);
Flow.Interview.Update Testupdate= new Flow.Interview.Update (params);
TAPCallFlow.start();
String returnValue = (String) Testupdate.getVariableValue('objectAId');
}

'objectAId' - this is the variable created in Flow.

Flow implemented so far :

Step 1 : To check if the record of object A exist with the Account as lookup , As Account and Object A have Master Detail relationship. Step 2 : If the Object A exist with the Account , then create the related Object B whose given condition is true, then the Object B should get automatically created under Object A related list.

We have implemented the creation of Object B through Flow, but the initial after insert trigger , when we run the flow we are getting an error as Flow returns Null. i.e. the flow is not getting the Object A Id. So, let me know if we are missing anything in the trigger while invoking the flow?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.