Print

GetAttachmentData

A GetAttachmentData() function returns a value of a specified parameter of the currently selected attachment.

Syntax

GetAttachmentData(fieldTitle,paramName);

Function arguments

  • fieldTitle – (String) a name of the case document-type field containing attachment or name of the case attachment.
  • paramName – (String) a name of the parameter that is to be retrieved for the given attachment. Allowed values: [ id | createddate | createdbyid | createdbylogin | modifieddate | modifiedbyid | modifiedbylogin | name | extension | isexternal | externallink | version | size | ocrid | ocrstate | ocrpagecount | ocrresponse | hash | pagecount | value].

Return value

This function returns String.
The GetAttachmentData() function returns the value of the specified parameter from the file attached in the specified case field or the case attachment list. If the „value” parameter is used this function will return an attachment content encoded with BASE64 algorithm.

WARNING! In case of passing not existing parameter name, this function throws an exception registered in the system log and stops rule execution. You can handle this exception by using try{…} catch {…} formula.

Examples

Example 1:
This returns the extension of the attachment from the current case’s 'AttachmentField1′ field.

attextension = GetAttachmentData("AttachmentField1","extension");

Example 2:
Let’s assume that there is a document-type field named ”Document scan” on the case form and a user wants to get information about a volume of the attached file to the „Document scan” field. The following sample code throws an exception because there is no 'volume’ parameter for the attached file. The exception is handled in try {…} catch {…} formula.

try
{
  sFileVolume = GetAttachmentData("Document scan","volume");
}
catch
{
  ShowMessage(1,"The attached file has no such parameter as 'volume'. Exception details: "+exception);
}
Czy artykuł był pomocny?
0 na 5 gwiazdek
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
How Can We Improve This Article?