Summary:
This article describes the step-by-step process of creating a FlowService in webMethods.io New Flow Editor to sync ServiceNow Purchase Order Items to Coupa Requisitions.
Prerequisites:
- User needs to have a working Coupa account, to log into the Coupa tenant
- User needs to have a working ServiceNow account, to log into the ServiceNow tenant
- Access permission for Coupa APIs and ServiceNow APIs
- Working webMethods.io tenant
Contents:
How to create a FlowService in FlowEditor to sync ServiceNow Purchase Order Items to Coupa Requisitions.
Steps to create flowservice to sync ServiceNow Purchase Order Items to Coupa Requisitions:
1. Login to webMethods.io integration
2. Click on Project and navigate to FlowServices
3. Create a flowservice and provide a name.
4. Start typing try and select Try...Catch... from dropdown options.
5. To add a comment click on the dots on the right side of the control and select “Comment“ from the dropdown.
6. Start typing transform and select Transform Pipeline from dropdown
7. Add “getCurrentDateString“ and map to “startDateTime“ and “endDateTime“.
8. Add “incrementDate“ and map I/O as below:
startDatePattern: yyyy-MM-dd'T'HH:mm:ss'Z'
endDatePattern: yyyy-MM-dd'T'HH:mm:ss'Z'
addDaye: -60
9. Add ServiceNow connector and create custom operation “queryPurchaseOrders“
Click on + button to create a new connection or select an existing connection
Select “List Records“ in operation name
Select “proc_po“:
Select output fields:
Review the summary and click on Done:
10. Do the mapping for the connector as below:
11. Check size of list for output from the previous step.
12. Add repeat if size is greater than 1
13. Following steps similar to step 9, add “getPurchaseOrderLineItems“ custom operation to ServiceNow connector by selecting “List“ in operation and “proc_po_item“ in Business object.
Do the mapping as below:
14. Check size of list “proc_po_item“
15. Add repeat if in case size from previous step is greater than 1 and add if-else to check requisitionID exists.
16. Do nothing in case requisition ID exists.
17. In else block add a custom operation “createRequisition“ for Coupa connector
Select existing connection or click on + button to add connection by providing all the details.
Fill in other details and click on next
Select operation “Create“
Select “Requisitions“
Select required fields:
On next screen review summary and click on Done.
18. Connector operation should look like this
19. Add getLastError in Catch block
20. Below is the full service created
21. Run service to get results