Question

Create role programatically

When I create a new account, I would like to create an organizational role with the same name as the account.  Later, when linking contacts to the account, I would like to add them to that role.  I want to do this in business processes, presumably in User Tasks.  Can you point me to relevant classes/api's?

Like 0

Like

4 comments

Hello Glenn,

 

Hope you're doing well.

 

If I understood your task correctly you can reach your goal by using the Business Process. To add the organizational role via a business process please create a process that could contain the "Add data" process element with the following parameters:

 

 

As a result the organizational role will be created:

 

 

About the second part of the question: you can do this with the "Add data" element as well by adding data to "User in roles" object with columns "User" populated as an ID of the user (Reading data from the object "User in roles") and "Role" populated as an ID of the role ('Reading data' also from the object "User in roles"). Also you can  try to use [SysAdminUnit] table. It contains Users, Roles and Contact references.

 

Best regards,

Roman

Roman Rak,

Thanks, this looks like it will do what I need.  One question.  You set the value of Type = 1 for the System Admin Unit.  Are the possible values documented anywhere?

Roman Rak,

One additional question.  The purpose of this application is to provision a new customer and its users.  The last step I would like to do is grant licenses to the newly created users.  Is that possible?

Show all comments