Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

This document describes the steps to automate P2 Container Request via Flow.

  1. Under the Invocable class, one need to create a wrapper by setting the following attributes as per requirement:-

    public class P2ContainerRequestWrapper {
        public String sParentRecordId {get;set;}
        
        public String firstName {get;set;} 
        public String lastName {get;set;} 
        public String email {get;set;} 
        public String phone {get;set;} 
        public String modeOfCommunication {get;set;}  //Email, SMS or Both
        public DateTime expirationDate {get;set;} 
        public Boolean tfaRequire {get;set;} 
        public String tfaMethod {get;set;} //If tfaRequire is set to True
        public String requesterFirstName {get;set;} 
        public String requesterLastName {get;set;} 
            
        public String sTemplateName {get;set;}
        public String smsBody {get;set;} 
        public String emailSubject {get;set;} 
        public String emailBody {get;set;} 
        public String defaultMessage {get;set;}
        
        public List<Recipient> recipients {get;set;}
        public class Recipient{
            public String firstName {get;set;} 
            public String lastName {get;set;} 
            public String email {get;set;} 
            public String phone {get;set;} 
            public List<RecipientItem> recipient_items {get; set;}
        } 
    }

Create an object of Wrapper and set all the required values

P2ContainerRequestWrapper oWrapper = new P2ContainerRequestWrapper();
oWrapper.sParentRecordId = <Record Id of the record to which the P2 Request will be linked to>

oWrapper.firstName <First Name of the End User to whom request needs to be sent>
oWrapper.lastName  <Last Name of the End User to whom request needs to be sent>
oWrapper.email     <Email of the End User to whom Request needs to be sent>
oWrapper.phone     <Phone of the End User to whom request needs to be sent>
oWrapper.modeOfCommunication  <Mode to send the P2 Request- email, sms or both>
oWrapper.expirationDate       <Expiration Date of the Container>
oWrapper.tfaRequire           <Set if TFA(2-Factor Authentication) is required on the Container>
oWrapper.tfaMethod            <Set the Method- Email or Phone if TFA is enabled>
oWrapper.requesterFirstName   <First Name of the User creating the Container>
oWrapper.requesterLastName   <Last Name of the User creating the container>

oWrapper.sTemplateName = <In case of using the Template no need to set SMS and Email Content>
OR
oWrapper.smsBody = <SMS Message to be sent for P2 Request>
oWrapper.emailSubject = <Email Subject for P2 Request>
oWrapper.emailBody = <Email Body for P2 Request>
oWrapper.defaultMessage = <Default Message if Any>

List<Recipient> listRecipient = new List<Recipient>();
P2ContainerRequestWrapper.Recipient oRecipient = new P2ContainerRequestWrapper.Recipient();
oRecipient.FirstName = <First Name of the End User to whom request needs to be sent>
oRecipient.LastName = <Last Name of the End User to whom request needs to be sent>
oRecipient.Email = <Email of the End User to whom Request needs to be sent>
oRecipient.Phone = <Phone of the End User to whom request needs to be sent>
listRecipient.add(oRecipient);
oWrapper.recipients = listRecipient;

Serialize the wrapper using JSON.serialize method

String sWrapper = JSON.serialize(oWrapper);
cm_datatransfer.GlobalServices.createP2Container(String sWrapper);
  • No labels