For more information about creating activities, see Cretaing a Pega activity.
Pages & Classes
| Page name | Class |
|---|
| Case | Work- |
| Attachment | Data-WorkAttach-File |
| AttachmentInfo | Data-WorkAttach-File |
Parameters
| Name | Data type | Required |
|---|
| CaseId | String | Yes |
Local variables
| Name | Data type |
|---|
| LinkedRefTo | String |
| Id | String |
| BatchId | String |
Steps
Step 1:
Method: Obj-Open-By-Handle.
Step page: Case.
InstanceHandle: Param.CaseId.
Step 2:
Method: Page-Set-Messages
Message: “Please add files to case before proceeding.”
When:
| When | if true | true param | if false | false param |
|---|
| AttachmentsIsNull | Continue Whens | | Skip Step | |
In order to create a condition, specify AttachmentsIsNull in the When field and click the configuration button. If such a condition does not already exist, window will open where you will be able to create a new condition. Make sure that the full name of the case is specified in the Apply to field and click Create and open. On the Conditions tab, create the following condition: length of .pyAttachments is Equal To 0. To add the condition, click Configure advanced conditions here… and select the length of [a pagelist property] Is [comparison operator] [value] for the condition type.
Jump:
| When | if true | true param | if false | false param |
|---|
| true | Exit Activity | | | |
Step 3:
Method: Call-Function
| Function | Return value |
|---|
| @ABBYY.CreateNewBatch() | Local.BatchId |
For more information, see CreateNewBatch.
Jump:
| When | if true | true param | if false | false param |
|---|
| StepStatusFail | Jump to Later Step | ERR | | |
On exception, jump to later step label: ERR.
Step 4:
Method: Property-Set
| PropertiesName | PropertiesValue |
|---|
| Local.LinkedRefTo | Case.pyAttachments(<CURRENT>).pxLinkedRefTo |
| Local.Id | Case.pyAttachments(<CURRENT>).pzInsKey |
Loop:
| Repeat | Value List Property |
|---|
| For each element in value list | Case.pyAttachments |
Substep 1:
Method: Obj-Open-By-Handle.
Step page: Attachment.
InstanceHandle: Local.LinkedRefTo.
Substep 2:
Method: Obj-Open-By-Handle.
Step page: AttachmentInfo.
InstanceHandle: Local.Id.
Substep 3:
Method: Call-Function
| Function | Return value |
|---|
| @ABBYY.AddDocumentToBatch(Local.BatchId, AttachmentInfo.pyMemo, Attachment.pyAttachStream) | |
For more information, see AddDocumentToBatch.
Jump:
| When | if true | true param | if false | false param |
|---|
| StepStatusFail | Jump to Later Step | ERR | | |
On exception, jump to later step label: ERR.
Step 5:
Method: Call-Function
| Function | Return value |
|---|
| @ABBYY.RunBatchProcessing(Local.BatchId) | |
For more information, see RunBatchProcessing.
Jump:
| When | if true | true param | if false | false param |
|---|
| StepStatusFail | Jump to Later Step | ERR | | |
On exception, jump to later step label: ERR.
Step 6:
Method: Call-Function
| Function | Return value |
|---|
| @ABBYY.WaitFirstVerificationOrProcessedForMultiFileInvoice(Local.BatchId) | .VerificationUrl |
For more information, see WaitFirstVerificationOrProcessedForMultiFileInvoice.
Jump:
| When | if true | true param | if false | false param |
|---|
| StepStatusFail | Jump to Later Step | ERR | Jump to Later Step | OK |
On exception, jump to later step label: ERR.
Step 7:
Label: ERR.
Method: Page-Set-Messages.
Message: @unescapeHTML(@getWorstMessageName(tools)).
For more information, see unescapeHTML.
Step 8:
Label: OK.
Method: Property-Set.
| PropertiesName | PropertiesValue |
|---|
| .BatchId | Local.BatchId |
