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 Version History

« Previous Version 2 Current »

Create an Invocable Apex Class

Get the variables from the flow

String templateId = <Id of the Document template Record you want to use>
String recordId = <Id of the sObject Record on which you want to trigger the document workflow>

Inside The Invocable Class Invoke Generate Document Service

String sResponse= docgen_esign.GlobalServices.generateDocument(templateId,recordId);

Deserialize the sResponse into type Map<String,Object>

Object deserializedObject = JSON.deserializeUntyped(sResponse);
Map<String, Object> outputMap = (Map<String, Object>)deserializedObject;                

Check the status

if(outputMap.containsKey('bSuccess')){
 
 if((Boolean)outputMap.get('bSuccess') ){
 //Document WorkFlow Created
 }
 else{
//Get the error                    
String error = outputMap.containsKey('Message')?(String)outputMap.get('Message'):'Something Went Wrong While Generating Document';
 }  

  • No labels