1.6 Add a Role to a User

Revised: 24 April 2017

Overview

Users in Coupa can have different roles. If roles are maintained in the HR system, it can be interfaced to Coupa. (Roles must be set up in Coupa as prerequisites.)

Using API

  1. Add the (Buyer) role to a User in the HR system.

  2. The ERP Connector platform should trigger an API call to Coupa using GET API to query the User’s <id> that you need to update (based on “login”, for example, but any queryable field/tag can be used depending on business scenario).

  3. The ERP Connector platform should trigger a Coupa PUT API to update the status for the User in Coupa using the User's <id>.

  4. Ensure that you get a 200 API response and it is logged in your ERP Connector platform logging engine. If you get a different API response (for example, 400) error, the API error (returned on API response <errors><error> tag(s)) must be logged in the ERP Connector platform logging engine and a notification must be sent to the relevant person to investigate.

  5. Validate that the User in Coupa has the (Buyer) role.

Sample API

In this example, a User is queried based on the User's “login” name (USER_TEST); then the API response Coupa user <id> is used to update the Coupa User's status to include the (Buyer) role.

GET

https://<instance_url>/api/users?login=USER_TEST

User <id> is 277.

PUT

  https://<instance_url>/api/users/277

Payload

<?xml version="1.0" encoding="UTF-8"?>
<user>
  <roles>
    <role>
      <name>Buyer</name>
    </role>
  </roles>
</user>

Using CSV

  1. Add the (Buyer) role to a User in the HR system.

  2. The ERP Connector platform generates a CSV flat file containing the changes that you want to see in Coupa

  3. The ERP Connector platform places the CSV file to the /Incoming/Users folder on the Coupa sFTP site.

  4. Once the scheduled job picks up and processes the file, validate that the (Buyer) role is added to the User.

Note that the CSV flat file overwrites the roles you already have in Coupa, so you need to have all roles in the CSV flat file. If the User had five roles, but you add only one role to the CSV flat file, when you upload the file, the User will have only the new role.

Sample CSV

Place the CSV file to the/Incoming/Users folder, where the file is picked up and processed in 5 minutes, and validate that the User's details are updated.

For a sample file, see add_role_user.csv.

The CSV flat file upload is monitored in Coupa at https://<instance>/data_sources. Coupa sends a notification to Coupa Admin on an upload failure, and Coupa Admin needs to investigate further.