getDocument
From AgileApps Support Wiki
Retrieves a document specified by its ID.
- Syntax
Result result = Functions.getDocument(String documentID);
- Parameters
- documentID - The ID of a document stored in the platform.
- Returns
- Result object that contains the document in the form of a PlatformFileBean.
- Usage
-
- Use result.getParameters() to get the params from the Result object.
- Call getPlatformFileBean() on the params, passing the document ID as a string.
- 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.
Result result = Functions.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");