Skip to main content
Question

BPA Add New User to Company

  • September 11, 2024
  • 1 reply
  • 67 views

Forum|alt.badge.img+1
  • Do Gooder (Partner)

HI,

I try to build BPA:

when new User is created, workflow should be fire →   User should be added to default Company.

 

Workflow:

1/ READ from Company  

2 / CALL to add User to Company 

Why doesn't it work?

I'm trying to do it in various ways, but also nothing...

Maybe someone has an idea what it should look like?

1 reply

WEYHAKAN
Do Gooder (Customer)
  • Do Gooder (Customer)
  • April 29, 2026

Hi JKK,


it’s been over a year since you asked that question, but I’ve recently built a similar automation. It might still be interesting...

 

Add User to Company

To add a user to the company, I set these values in the API Call of my workflow:

  1. Action = Call
  2. API Name = UserHandling
  3. Call Name = CompaniesNotGranted_AddToUser():Void

This API expects the following two parameters:

  • Company
  • Identity

 

Set Parameters Company & Identity for API Call

You’ve already obtained the value for Company via the READ of the Company, so the UserId is still missing.
That’s why I added some JavaScript code beforehand to set the missing parameter (or both parameters). So I used the “Script Task” in the Workflow:

  1. Script Format = JavaScript
  2. Script Format = Inline Script
  3. Script:

    var identity = execution.getVariable('UserId'); //read UserId...
    execution.setVariable('Identity', identity);       //...and map it to parameter Identity of API

    //you can also set the company
    execution.setVariable('Company', '<my company id>');

 

Overview Flow

These are the step in the Workflow:

  1. Read Company (sets parameter for Company)
  2. Set parameter for Identity
  3. Add User to Company (uses parameters Company & Identity)

 

Best wishes,

Hakan