Difference between revisions of "GenerateDocument"
From AgileApps Support Wiki
imported>Aeric |
imported>Aeric |
||
Line 16: | Line 16: | ||
:;recordID:The identifier of the related record | :;recordID:The identifier of the related record | ||
:;printTemplateID:The name of the [[Print Templates|print template]] | :;printTemplateID:The name of the [[Print Templates|print template]] | ||
:;format:You can specify <tt> | :;format:You can specify <tt>CONSTANTS.DOCUMENT.FORMAT.HTML</tt> or <tt>CONSTANTS.DOCUMENT.FORMAT.PDF</tt> | ||
'''Return''' | '''Return''' | ||
Line 31: | Line 31: | ||
// Some code to populate printTemplateID. | // Some code to populate printTemplateID. | ||
// Some code to populate leadID. | // Some code to populate leadID. | ||
Result result = Functions.generateDocument("LEAD", leadID, printTemplateID, | Result result = Functions.generateDocument("LEAD", leadID, printTemplateID, CONSTANTS.FILE.FORMAT.HTML); | ||
int resultCode = result.getCode(); | int resultCode = result.getCode(); | ||
if(resultCode < 0) | if(resultCode < 0) |
Revision as of 19:24, 16 August 2011
- Functions.generateDocument(String objectId, String recordId, String templateId, String format)
- Generates document of templateId evaluated with params in the format.
- If the format is PDF, it generates the document in PDF format, otherwise HTML format. It relates this generated document to the object of type objectId and record identifier recordId.
Generates a document based on a Print Template.
Syntax
Result result = Functions.generateDocument(String objectID, String recordID, String printTemplateID, String format)
Parameters
- objectID
- The identifier of the related object
- recordID
- The identifier of the related record
- printTemplateID
- The name of the print template
- format
- You can specify CONSTANTS.DOCUMENT.FORMAT.HTML or CONSTANTS.DOCUMENT.FORMAT.PDF
Return
- Example
- This example calls generateDocument for a lead, creating a HTML document.
<syntaxhighlight lang="java" enclose="div"> String printTemplateID = ""; String leadID = ""; // Some code to populate printTemplateID. // Some code to populate leadID. Result result = Functions.generateDocument("LEAD", leadID, printTemplateID, CONSTANTS.FILE.FORMAT.HTML); int resultCode = result.getCode(); if(resultCode < 0) {
String msg = "Some Message"; Functions.debug(msg + ":\n" + result.getMessage()); // Log details Functions.throwError(msg + "."); // Error dialog
} else {
// Some business logic.
} </syntaxhighlight>