...
This document describes the steps to automate P2 Container Request via Flow.
Table of Contents | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Create an Invocable Apex Class
Create a Wrapper
Under the Invocable class, one need to create a wrapper by setting the following attributes as per requirement:-
Code Block public class P2ContainerRequestWrapper { @AuraEnabled public String sParentRecordId {get;set;} @AuraEnabled public String sTemplateName {get;set;} @AuraEnabled public String smsBody {get;set;} @AuraEnabled public String emailSubject {get;set;} @AuraEnabled public String emailBody {get;set;} @AuraEnabled public String defaultMessage {get;set;} @AuraEnabled public datetime lastOnline {get;set;} //Add another Object to Allow Multiple Recipient @AuraEnabled public List<Recipient> recipients {get;set;} public class Recipient{ @AuraEnabled public String firstName {get;set;} @AuraEnabled public String lastName {get;set;} @AuraEnabled public String email {get;set;} @AuraEnabled public String phone {get;set;} @AuraEnabled public List<RecipientItem> recipient_items {get; set;} @AuraEnabled public Boolean isTFAEnabled {get;set;} @AuraEnabled public String tfaMethod {get;set;} } @AuraEnabled public String firstName {get;set;} @AuraEnabled public String lastName {get;set;} @AuraEnabled public String email {get;set;} @AuraEnabled public String phone {get;set;} @AuraEnabled public String modeOfCommunication {get;set;} //Email, SMS or Both @AuraEnabled public DateTime expirationDate {get;set;} @AuraEnabled public Boolean tfaRequire {get;set;} @AuraEnabled public String tfaMethod {get;set;} @AuraEnabled public Boolean enableTeamFeature {get;set;} @AuraEnabled public Boolean bAutomation {get;set;} public String requesterFirstName {get;set;} Public String requesterLastName {get;set;} }
Set the values in the Wrapper
Create an object of Wrapper and set all the required values
Code Block |
---|
P2ContainerRequestWrapper oWrapper = |
...
Under the Wrapper, one need not to set if there is only 1 API Key in use, Last Online need not to be set.
...
new P2ContainerRequestWrapper();
oWrapper.sParentRecordId = <Record Id of the record to which the P2 Request will be linked to> |
Serialize the Wrapper
Serialize the wrapper using JSON.serialize method
Code Block |
---|
String sWrapper = JSON.serialize(oWrapper); |
Call the Global Method of Managed Package to initiate the process.
Code Block |
---|
cm_datatransfer.GlobalServices.createP2Container(String sWrapper); |