Difference between revisions of "GenerateDocument"
From LongJump Support Wiki
imported>Aeric |
imported>Aeric |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:generateDocument}} | {{DISPLAYTITLE:generateDocument}} | ||
<tt>Functions.generateDocument(String objectId, String recordId, String templateId, String format)</tt> | |||
:Generates document of <tt>templateId</tt> evaluated with <tt>params</tt> in the format. | :Generates document of <tt>templateId</tt> evaluated with <tt>params</tt> in the format. | ||
Line 12: | Line 12: | ||
'''Syntax''' | '''Syntax''' | ||
:<syntaxhighlight lang="java" enclose="div"> | |||
Result result; | |||
result = Functions.generateDocument(String objectID, String recordID, | |||
String printTemplateID, String format); | |||
</syntaxhighlight> | |||
'''Parameters''' | '''Parameters''' | ||
Line 20: | Line 24: | ||
:;printTemplateID:The name of the [[Print Templates|print template]] | :;printTemplateID:The name of the [[Print Templates|print template]] | ||
:;format:You can specify <tt>CONSTANTS.DOCUMENT.HTML</tt> or <tt>CONSTANTS.DOCUMENT.PDF</tt> | :;format:You can specify <tt>CONSTANTS.DOCUMENT.HTML</tt> or <tt>CONSTANTS.DOCUMENT.PDF</tt> | ||
::This option applies to HTML and PDF templates. Word templates always produce Word files. PowerPoint templates produce PowerPoint files. | |||
'''Return''' | '''Return''' | ||
Line 27: | Line 32: | ||
;Example:This example calls <tt>generateDocument</tt> for a lead, creating a HTML document. | ;Example:This example calls <tt>generateDocument</tt> for a lead, creating a HTML document. | ||
: | :<syntaxhighlight lang="java" enclose="div"> | ||
<syntaxhighlight lang="java" enclose="div"> | |||
String printTemplateID = ""; | String printTemplateID = ""; | ||
String leadID = ""; | String leadID = ""; | ||
Line 47: | Line 50: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<noinclude> | |||
[[Category:Email and Document Management]] | |||
</noinclude> |
Latest revision as of 22:48, 26 June 2014
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 an HTML Print Template.
- Considerations
- JSP Print Templates cannot be used, currently.
Syntax
Result 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.HTML or CONSTANTS.DOCUMENT.PDF
- This option applies to HTML and PDF templates. Word templates always produce Word files. PowerPoint templates produce PowerPoint files.
Return
- Example
- This example calls generateDocument for a lead, creating a HTML document.
String printTemplateID = ""; String leadID = ""; // Some code to populate printTemplateID. // Some code to populate leadID. Result result = Functions.generateDocument("LEAD", leadID, printTemplateID, CONSTANTS.DOCUMENT.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. }