how to programmatically add user to Groups?

how to programmatically add user to Groups?

  

Dear all,


During initialize of application, we need to upload the user data into Users table and then assign to the group.

How to do that in program?


thank you.

Hi MK,

Here is a step-by-step process that can help you on your inquiry:

  1. Manage your dependencies by getting the entities "Group" and "Group_Users"
  2. In your Upload Function (Bootstrap), Upload/insert first the user data into Users entity
  3. upon creation of the User, get the Group that you want the user to be assign by means of querying it using Aggregate or Advance Query. 
  4. Create a Group_User record variable and assign the UserId and the GroupId to that variable.
  5. Drag the "CreateGroup_User" action from the Group_Users Entity and assign the record variable to it.

Hope it helps


Kind regards,

Cy

Solution

Cy wrote:

Hi MK,

Here is a step-by-step process that can help you on your inquiry:

  1. Manage your dependencies by getting the entities "Group" and "Group_Users"
  2. In your Upload Function (Bootstrap), Upload/insert first the user data into Users entity
  3. upon creation of the User, get the Group that you want the user to be assign by means of querying it using Aggregate or Advance Query. 
  4. Create a Group_User record variable and assign the UserId and the GroupId to that variable.
  5. Drag the "CreateGroup_User" action from the Group_Users Entity and assign the record variable to it.

Hope it helps


Kind regards,

Cy

Thanks Cy for quick response but can't find way to add dependencies to Group n Group_Users. 

Can find Users under System but not Users.

Please advise, thanks in advance.


Solution

MK MK wrote:

Thanks Cy for quick response but can't find way to add dependencies to Group n Group_Users. 

Can find Users under System but not Users.

Please advise, thanks in advance.


Hi MK,

You can find the Entity "Group" and "Group_User" Under System


Kind Regards,

Cy


Cy wrote:

MK MK wrote:

Thanks Cy for quick response but can't find way to add dependencies to Group n Group_Users. 

Can find Users under System but not Users.

Please advise, thanks in advance.


Hi MK,

You can find the Entity "Group" and "Group_User" Under System


Kind Regards,

Cy


Wow, another quick response. It worked, thanks a lot Cy, another plus point for OutSystems.

MK MK wrote:


Wow, another quick response. It worked, thanks a lot Cy, another plus point for OutSystems.

No problem :D


Kind regards,

Cy