Signature

global static void generateDocument(
  List<Types.DocGenRequestInput> payloads,
  String runAs
)
Parameters
ParameterDescription
payloads requiredOne entry per document generation request. See Types.DocGenRequestInput.
runAs
String
optionalUsername to attribute the operation to; usually a static value such as 'integrationUser'.

Return Type

void

Example

cldfs.DocGenParams dcp = new cldfs.DocGenParams();
dcp.PdfViewPassword = 'admin';
dcp.PdfOwnerPassword = 'superadmin';
dcp.LockPdf = true;
dcp.AllowPdfPrinting = true;
dcp.AllowFillingPdfFormFields = true;

cldfs.Types.DocGenRequestInput docGenInputs = new cldfs.Types.DocGenRequestInput(
  '681b4169c697ffdc2aab2731',
  new Map<String, String>{ 'userId' => '005dL000008FbqgQAC', 'recordId' => '003dL00000YsapJQAR'},
  'pdf',
  new cldfs.Resource(
    '68887db5ef0b3ca7534dbbd5',
    'folder',
    null,
    'cloudfiles',
    'workspace'
  ),
  dcp
);
List<cldfs.Types.DocGenRequestInput> payload = new List<cldfs.Types.DocGenRequestInput>{
  docGenInputs
};
cldfs.Client.generateDocument(
  payload,
  'integrationUser'
);
Document Generated eventAfter the file is successfully generated, a Document Generated platform event is published. You can use this event as a trigger in Apex or Flows to perform your next steps.