-
Notifications
You must be signed in to change notification settings - Fork 217
Example: Bulk Approvals
Nolan Ehrstrom edited this page Feb 6, 2020
·
14 revisions
Video Demo: https://drive.google.com/open?id=1IrE2wBW5sp_uu8vJqYpvJ_6ty4SUgdkx
Here is an example of how to bulk approve a number of pending requests using a separate process. This demonstrates data sources, screen builder's loop control, API and the SDK.
Note that this relies on these 2 PRs to be merged:
- https://github.com/ProcessMaker/processmaker/pull/2813
- https://github.com/ProcessMaker/screen-builder/pull/535
At the time of writing, importing and exporting data sources is not supported. It must be manually added with the steps below.
- Install package-data-sources
- Generate a token for admin user
- Create a new data source. Set auth to 'bearer token' and set the token from above.
- Add a new list endpoint GET:
http://pm.local.processmaker.com/api/1.0/tasks?&include=data&pmql=(request%20%3D%20%22Application%22)%20AND%20(task%20%3D%20%22Approval%22)%20AND%20(status%20%3D%20%22In%20Progress%22)
- Replace
http://pm.local.processmaker.com
above with your PM4 server.
- Replace
- Import these 2 processes from the below zip file. Assignments can be left as defaults except the script task in the Bulk Approval process must be set to the Admin user.
- Edit the 'Bulk Approval' process.
- Add a Data Connector node between 'start event' and 'bulk approve form' and connect them
- In the Configuration, set the Data Connector and Endpoint to the one you created above
- In Data Mapping, set a Form Data key 'tasks' with a value 'data'. Save the process.
To run the example:
- Start a new 'Application' request.
- Open the task. Fill out the text and submit.
- Do not complete the next 'Approval' task. Leave it in a 'In Progress' state.
- Do this for a few more applications.
- Start a new 'Bulk Approvals' request. Wait for the data connector to complete and open the task.
- From here, you should see all 'In Progress' applications with the ability to bulk approve or deny them.