AgileApps Support Wiki Pre Release

GetDocument

From AgileApps Support Wiki
Revision as of 04:03, 16 January 2014 by imported>Aeric

Description...

Syntax
<syntaxhighlight lang="java" enclose="div">

Result result = Functions.__apiName__(String objectName, String fields, String criteria); Result result = Functions.__apiName__(String objectName, String fields, String criteria

                           [, Parameters params] );

Result result = Functions.__apiName__(String objectName, String fields, String criteria); Result result = Functions.__apiName__(String objectName, String fields, String criteria,

                           String sortBy, String sortOrder, 
                           String sortBy2, String sortOrder2, 
                           int offset, int numberOfRows);

</syntaxhighlight>

Parameters
objectName
The object name or identifier
fields
A comma-separated list of names of the fields to retrieve
criteria
A filter expression that specifies records to select.
params
An optional Parameters object that contains additional parameters:
  • param - ...
Returns
Result object that contains the document in the form of a PlatformFileBean.
Usage
  1. Use result.getParameters() to get the params from the Result object.
  2. Call getPlatformFileBean() on the params, passing the document ID as a string.
  3. If needed, call getBytes() on the PlatformFileBean to get document content in a byte array.
Example
This example logs the size and name associated with a document.
<syntaxhighlight lang="java" enclose="div">

Result result = getDocument(documentId); Parameters params = result.getParameters(); PlatformFileBean file = params.getPlatformFileBean(documentId); byte[] bytes = file.getBytes(); String msg = "Name:"+file.getName()+", size:"+file.getEncodedFileContent().length(); Logger.info(msg, "Document"); </syntaxhighlight>