Example: Export Invoices using Process Automator
Step-by-step example for sending an invoice to a third-party system once it's approved.
In this example, you will:
- Create a process to send Invoices to a third-party system using an API Call Out once approved. For more information, see Call Outs.
- Define and apply a Data Mapping to ensure that the data sent can be processed by the third-party. Data Mappings transform the API call out payload from Coupa’s standard format to the format expected by the target system, reducing the need for third-party middleware.
- Process the response from the API Call Out using API Call Out response variables. Response variables allow you to process the response from an API call and use the values in later steps.
- Set fields on the invoice record once the API call completes successfully.
- Handle errors by retrying unsuccessful Call Outs and monitoring progress using the Integration Control Center.
Procedure
- Create a process according to Create a Process Using Process Automator.
- Set Launch Process On to Document Event and set the Document to Invoice.
- Set Trigger Process On to Approval. This triggers the process every time an Invoice is approved.
- Add Step 1 to send an API Call Out to a third-party system and process the response.
Field Value Object Select Trigger.Invoice to apply the action to the trigger document. Action Select API Call Out to send an API Call to a third-party system every time an invoice is approved. Call Out Select a Call Out that includes information regarding the third-party endpoint you would like to send Invoice information to. See Call Outs. Data Mapping Optional. Select a Data Mapping that maps Coupa Invoice data to the data model in your third-party system. See Data Mapping. API Filter Optional. Apply a filter to determine which Invoice fields to include in your Call Out. See API Response Filters. API Call Out Response Variables Optional. Create a variable to hold the value of an element from the third-party system API call response. In this example, you can define an ID variable to hold an ID element. You need to inspect the API call's response to determine the exact path. For example, the invoice ID might be configured as /invoice/record_id
.Conditions Optional. Add conditions to further restrict which approved invoices should trigger the process. - Add Step 2 to set a field on the Invoice record that includes the ID from the third-party system. This ID is contained in the variable created in Step 1 API Call Out Response Variables.
Field Value Object Select Trigger.Invoice to apply the action to the trigger document. Action Select Set Field to set a field value on the Invoice object. Field Type Select Standard or Custom depending on the field to set. In this example, you could add a custom field to the Invoice object called ERP record ID. Field Name Select the standard or custom field to set. Use Response Variables Select Yes. Field Value Select the response variable you created in step 1. For example, if you named the response variable Invoice ID, then you would select Step 1.Invoice ID. - Add Step 3 to set a field on the Invoice record indicating that the object was exported to ensure you are not exporting data redundantly into your other systems.
Field Value Object Select Trigger.Invoice to apply the action to the trigger document. Action Select Set Field to set a field value on the Invoice object. Field Type Select Standard or Custom depending on the field to set. In this example, you could add a custom field to the Invoice object called Exported. Field Name Select the standard or custom field to set. Use Response Variables Select No. Field Value Select an appropriate field value. For example, if you added a Boolean custom field called Exported, you could set the field to true. - View the Integration Control Center to manage your API calls and troubleshoot issues.
- Navigate to the Integration Control Center to view your API Call Out status.