Completing Assignments using API
- 01 Jun 2021
- 2 Minutes to read
- Print
- DarkLight
This documentation version is deprecated, please click here for the latest version.
Completing Assignments using API
- Updated on 01 Jun 2021
- 2 Minutes to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Overview
Decisions offers the ability to Call Internal Services using API Calls. One of these services is the Assignment Service, which allows an API call to update, modify, or add information to an Assignment. This feature allows for a third-party system to call into Decisions to create an Assignment for a user. The user will need to complete the Assignment if the "failure condition" in the other system automatically recovers. The service, Process Form Assignment Response, featured in this article allows this to happen.
Example
This example will set up a basic Assignment, get the Assignment ID, and use the ProcessFormAssignmentResponse Operation to gather the Integration Details and complete the Assignment using Postman.
Setup Assignment
- Starting in the Flow Designer, place an Add Task step onto the workspace. This example Task (Form) will be left blank; however, it may contain any customizable Form components needed for various use cases.
- With the task highlighted, locate the Assign To field in the Properties panel.
- Add an Assignee, or person the task will go to, by typing in the designated field. This example will use "admin@decisions.com."
- Give the Assignment an Assignment Name and an Assignment Action Name. Although it is best practice to have a dynamic Assignment Name, this example will use a Constant name.
- In the Properties panel, click the Edit button next to Assignment Setup.
- In the Assignment Setup dialog, scroll to the Additional Assignment Action section and select Add New.
- In the Add Action Definitions dialog, uncheck Can Respond Via Email.
- In the Allow Files drop down, choose NotAllow.
- Under Data > Outcome Name, type "Approved."
- Select OK to save.
- Upon return to the Assignment Setup dialog, define a Denied action in the same manner as the previously configured Approved action.
- When finished select Done.
- In the Flow Designer, save and close the Flow.
Integration Details
- In the Decisions Studio, navigate to System > Administration > Features > All Services.
- Select Assignment > Viewing Integration Details .
- In the Assignment Operations window, find and select ProcessFormAssignmentResponse.
- In the ProcessFormAssignmentResponse Operations window, set up the integration details and select Show. The URL and Body will need to be pasted into Postman to test.
Setup Postman
- In Postman, add a new POST request and paste the URL in the URL box.
- Paste the following code into the body.
This code was on the ProcessFormAssignmentResponse Operations page, but the file section was removed as this example did not allow files when setting up the assignment.
{
"userid": "admin@decisions.com",
"password": "admin",
"assignmentId": "StringValue",
"response": "StringValue",
"comment": "StringValue",
"outputtype": "Json"
}
Debug
- Run the Assignment Flow from the Designer Folder.
- Select No when prompted to complete the Assignment.
- Navigate to the Inbox Folder in the Folder tree.
- Select the Assignment waiting to be completed, choose Manage > Get Form Assignment ID.
- In the ID dialog, copy the Form Assignment ID then select Done.
- Navigate to Postman, next to "AssignmentId": replace "StringValue" with the Assignment ID that was just copied.
- Replace the StringValue of "Response" with Approved and then replace the StringValue of "Comment" with Done.
- Select Send to process the response. The Response panel will show the body of the response as "ProcessFormAssignmentReponseResult": null.
- Back in the Decisions Studio, refresh the screen and notice the Assignment is no longer in the Inbox Folder as it was completed using API.
Was this article helpful?