Child pages
  • Bulk Import of users with rolemembership
Skip to end of metadata
Go to start of metadata

Use Case request: Bulk load new users by importing a CSV file containing users with attributes and multiple roles into OpenIDM 4.0. It is assumed the roles already exist within OpenIDM. 

Example of CSV format:


The last field, the roles field contains multiple roles separated by "|" pipe character. 

Many thanks to Jake Feasel for figuring out the hard part, the transformation script. 

Step-by-step guide

This effort was based on OpenIDM4.0

  1. Create a CSV File Connector configured against the CSV import file.
  2. Create a new mapping from the CSV connector to the Managed User Object.
  3. On the Attributes Grid map each CSV column to the managed user target attribute. The main work is around mapping the multi-values roles from the CSV into the managed roles object. A transformation script is required to split the multiple roles and create the role memberships on openIDM.  

    The script used is: 
    .map(function (role) {
    return {
    _ref: 'managed/role/'+ (
    openidm.query('managed/role', {'_queryFilter':'/name eq "' + role + '"'}).result[0]._id)

  4. Update the Behavior Policies to Create when missing and run reconciliation. Upon completion, check Managed Users and new users should be created as well as roles membership added.