Applies to version 2020.1.3; author: Paweł Fijał
When creating the instance workflow in WEBCON BPS, they may be a situation where we would like the attachment added on the form to be stored in the cloud e.g. in OneDrive. People who are not taking part in the process will be able to access it. This article describes how to add attachments to OneDrive using the REST action.
The simple workflow of sending attachments has been created.
Fig. 1. The workflow of sending attachment
1. The configuration of auxiliary business rules
To configure the action of sending an attachment, auxiliary business rules have been created that will return the attachment type, name, and content.
Using the “CONTENT TYPE” built-in action in the SQL query allows you to return all attachment IDs added to the “Share” category on the form.
Fig. 2. The business rule that returns the attachment content using the “Content Type” function
The second business rule returns the name of the attachment added to OneDrive. The file name can be set according to the rules for creating the file name, but for the example described, the name will remain as in the original attachment.
Fig. 3. The business rule returning the file name
2. The path with actions
On the “Active” step, a dedicated “Send the attachment via OneDrive” path was added that contains several actions:
Fig. 4. Actions executed on the “Send the attachment via OneDrive” path
3. The configuration of the action
a) Get users drive ID
The configuration uses the GET method and the previously defined connection to Graph -> Integration with ADD using REST invoke method and Microsoft Graph.
Fig. 5. The “Authentication” tab
Fig. 6. The “Request data” tab and URL to OneDrive resource of the selected employee
Fig. 7. The “Response” tab configuration
b) Put attachment to OneDrive
The attachment is transferred using the PUT method.
Fig. 8. The selected PUT method and service URL defined
Fig. 9. The “Request body” configuration
c) Delete share attachment
You can add the action of deleting all attachments from the “Share” category with the option of leaving the attachment’s history selected.
Fig. 10. The configuration of deleting the attachment from the “Share” category
4. Actions – example
Below there is the example instance form with the selected employee in the “Employee” field and a payslip added in the .jpg format.
Fig. 11. Adding the attachment to the “Share” category
After going through the “Send the attachment via OneDrive” path, the attachment was sent to the employee’s drive in OneDrive and deleted from the form.
Fig. 12. The attachment was deleted from the form
The action of invoking REST Web service in WEBCON BPS allows you to send attachments to OneDrive to the specified resource. These resources can be defined dynamically – you can send the attachment to a dedicated place, or statically – the selected group of people have access to the selected resource.