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

How to user merge call with an invocable method to merge contact records.
Good afternoon all, I am working in Lightning.
I have a flow that i will be using for a self service deduping tool. I find that I need to pass data out of the flow and into Apex using an invocable method and i am not sure how to do that. i have very limited coding skills and could use some pointers.
I have looked up how to build an invocable method and how to use the merge call and tried to piece something togethe rthat will work but there are a few things I really need help with.
For example, the code I have has places for the contact IDs but I am unsure how these are passed into the code from the flow. Do I enter the variable the IDs are stored in from the flow?
Following is what I have so far so maybe you can point me in the right direction. As I mentioned, i am very new to coding so please forgive me for any glaring mistakes.
It is fine if you can just point me in the direction of some example sthat might help too.
All I need to do is pass two contact IDs through an ivocable method from a flow and have the method merge the two and delete the duplicate once merged.
Any help at all will be greatly appreciated.
Best regards,
Steve
I have a flow that i will be using for a self service deduping tool. I find that I need to pass data out of the flow and into Apex using an invocable method and i am not sure how to do that. i have very limited coding skills and could use some pointers.
I have looked up how to build an invocable method and how to use the merge call and tried to piece something togethe rthat will work but there are a few things I really need help with.
For example, the code I have has places for the contact IDs but I am unsure how these are passed into the code from the flow. Do I enter the variable the IDs are stored in from the flow?
Following is what I have so far so maybe you can point me in the right direction. As I mentioned, i am very new to coding so please forgive me for any glaring mistakes.
It is fine if you can just point me in the direction of some example sthat might help too.
All I need to do is pass two contact IDs through an ivocable method from a flow and have the method merge the two and delete the duplicate once merged.
Any help at all will be greatly appreciated.
Best regards,
Steve
You can refer to - https://developer.salesforce.com/forums/?id=9060G0000005nusQAA
All Answers
You can refer to - https://developer.salesforce.com/forums/?id=9060G0000005nusQAA
public class InvocableMethodsTest {
@InvocableMethod(label='Invocable Methods test' description='Testing the appearance of Invocable Methods in Flow Builder')
public static void InvocableMethodsTest(List<et4ae5.JBIntFireEventParams> fireEventParamList) {
}
// Insert new Contacts
List<Contact> ls = new List<Contact>{
new Contact(Id='0034100002GrtDTAAZ'),
new Contact(Id='0034100001tHiVeAAK')
};
{
insert ls;
// Queries to get the inserted Contacts
Contact masterCont = [SELECT Id, Name FROM Contact WHERE Id = '0034100002GrtDTAAZ' LIMIT 1];
Contact mergeCont = [SELECT Id, Name FROM Contact WHERE Id = '0034100001tHiVeAAK' LIMIT 1];
try {
merge masterCont mergeCont;
} catch (DmlException e) {
// Process exception
System.debug('An unexpected error has occurred: ' + e.getMessage());
}
}
}