eDoreczenia_SaveBusinessEvidence
The eDoreczenia_SaveBusinessEvidence() function saves a business evidence of the chosen type for the selected message as a file in specified location:
- a document field on the case;
- on the case document list;
- in the external path.
Syntax
eDoreczenia_SaveBusinessEvidence(mailboxId, messageId, evidenceType, storageInfo);
Function arguments
- mailboxId – (String) the identifier of the mailbox which stores the message for which business evidences will be downloaded and saved. The mailbox has to be registered in AMODIT with unique id.
- messageId – (String) the identifier of the message which contains the evidence to be downloaded.
- evidenceType – (Object) the type of the business evidence to download. Available types: 'BPWP’ (pdf), 'BPWX’ (xml), 'BPOP’ (pdf), and 'BPOX’ (xml).
- storageInfo – (Object) the argument which defines a place where a file with the evidence will be stored/saved.
Return value
The eDoreczenia_SaveBusinessEvidence() function returns Object.
This complex object contains the following properties:
- Success – returns True, if the operation succeeds;
- CombinedErrorMessage – returns a description of the error in case of the operation failure.
Examples
Example 1
The example saves the file of the selected 'BPWP’ business evidence (that is stored in AMODIT database and associated with message with given message ID) into the specified destination. In this case it is a path on the newtork share '\\my-networkshare\folder1′. The newly created file will get name 'mycustomname123.pdf’.
// select the type of evidence evidenceType = 'BPWP'; // choose type of storage type, available values: 'externalLocation', 'listOfDocuments' and 'field'. storageInfo.storageType = 'externalLocation'; // set a name for the file with the business evidence (optional). // File must have .pdf or .xml extension dependant on type of evidence: // 'BPWP' (pdf), 'BPWX' (xml), 'BPOP' (pdf), 'BPOX' (xml), 'HDW' (xml), 'HPN' (xml) and 'HEPO' (xml). storageInfo.filename = 'mycustomname123.pdf'; // set a name of the field where downloaded file with evidences should be placed // (property is required only when storageType is set to 'field'). storageInfo.fieldName = 'myDocumentTypeField'; // set the external location where file with the business evidence should be placed // (property is required only when storageType is set to 'externalLocation'). storageInfo.externalLocation = '\\my-networkshare\folder1'; // set flag to true in order to allow for overriding attachments. storageInfo.overrideAttachment = true; // execute the function with previously prepared arguments on behalf of mailbox // defined in field 'mailboxId'. response = eDoreczenia_SaveBusinessEvidence([mailboxId], [messageId], evidenceType, storageInfo); // verify status of operation if (!response.Success) { ShowMessage(1,response.CombinedErrorMesage); // display error message in case of failure }