AdvoLogix Help

Creating an AdvoDoc Document via Code

Updated on

The following Apex method can be used create a new document via custom coding. Please be aware this method requires knowledge of Force.com best practices and as always we suggest testing your code in the Sandbox.

Syntax:
DocumentService.storeDocument(
@recordId,
@templateId [,
@outputformat ]
);
 

Parameters:
@recordId
Required. The Id value of the base object's source record for which AdvoDoc should be generated for.

@templateId
Required. The AdvoDoc Template Id to be used for merging with the source record to create the new document.

@outputformat
Optional. The output format is either PDF or DOCX. This is an optional parameter and if not provided, the API function will default to the value provided on the AdvoDoc Template. If the template format is not specified the defaulted format will be PDF.

Result:
The function call will return a JSON formatted string in this format: {success:"",result:""}

success
Will be either TRUE or FALSE

result
A confirmation text of completion OR error text if the process is halted by an unexpected error.

Example:
DocumentService.storeDocument(
   'a0b9000000RJhKTEA1',
   'a0d9000000GTrsgAA4'
);

OR

DocumentService.storeDocument(
   'a0b9000000RJhKTEA1',
   'a0d9000000GTrsgAA4',
   ‘PDF’
);

 

Previous Article AdvoDoc Input Wizard
Next Article Creating an AdvoDoc Document via Process Builder
Still need help? Click here!
AdvoLogix® is a registered trademark of AdvoLogix.com LLC a Texas Limited Liability Company. All references to other trademarks belonging to third parties that appear on this website, documentation, or other materials shall be understood to refer to those registered trademarks owned by others, and not to any trademark belonging to AdvoLogix. Otherwise, all material herein is the copyright of AdvoLogix.com LLC. All Rights Reserved.