You need to sign in to do that
Don't have an account?

Creating a self service deduping tool with Flow and Invokable Method - Stuck on the code
I am so close on this one I think. I have built an invocable method to pass two contacts from a flow into Apex to merge the contacts but I am stuck in the part of the code to pass the IDs into the merge command.
Here is the code:

The code indicates that there the survivorCont and mergeCont variables do not exist.
I feel like I am very close on this one but could ureally use some help taking this accross the finish line.
Any thought sout there on this one?
Thanks much
Steve
Here is the code:
The code indicates that there the survivorCont and mergeCont variables do not exist.
I feel like I am very close on this one but could ureally use some help taking this accross the finish line.
Any thought sout there on this one?
Thanks much
Steve
But you don't have to query the records if you already have ids.
Bear in mind that it can hit the 150 DMLs limit because it's inside a loop. Unfortunately the merge method doesn't seem to work with lists but only single ids/records.
All Answers
But you don't have to query the records if you already have ids.
Bear in mind that it can hit the 150 DMLs limit because it's inside a loop. Unfortunately the merge method doesn't seem to work with lists but only single ids/records.
Question though, is this better run outsid ethe loop? and how would that work?
Sc
There is no ideal way to do it at the moment. You have to either only process one record pair at a time (which could work if it's called e.g. from a button) or protect the code against DML limit exceptions (which cannot be caught in a try..catch block) for example by checking the limits (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_limits.htm) with each iteration.
You can read more about invocable methods here: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm