To call Future methods from Process Builder, call the future method from the in-vocable method. Check the below code.
Sample Code:
public class LightningProcessBuilder {
@InvocableMethod
public static void sendEmailToOwner(List<String> listUserNames) {
callEmailSend(listUserNames);
}
@future
public static void callEmailSend(List<String> listUserNames) {
//Write the logic.
//If it is a call out, use callout = true in future annoation
}
}
Sample Code:
public class LightningProcessBuilder {
@InvocableMethod
public static void sendEmailToOwner(List<String> listUserNames) {
callEmailSend(listUserNames);
}
@future
public static void callEmailSend(List<String> listUserNames) {
//Write the logic.
//If it is a call out, use callout = true in future annoation
}
}
No comments:
Post a Comment