Add New User to an Existing Organization

You can add an end-user to an existing organization without creating a new organization for them. This can be done by providing the ZAAID of the organization that the user must be added to. The organization of a user cannot be changed later, once it is associated with their account.

When the user has signed up, unique identification values such as ZUID and User ID are created for them.

Note:

  • You must provide the values for zaaid, email_id, last_name mandatorily to add a user to an existing organization.
  • You can obtain the ZAID from the Environment settings in your Catalyst console.
  • You can also add them to a role by providing the role_id, which you can obtain from the Roles section in Authentication in the Catalyst console.

Create a JSON Configuration

Before you add a new end-user to your Catalyst application, you must create a JSON object that contains the registration details of a particular user as shown below. You can then pass the configuration to the user registration method.

Copied//Create a JSON object for adding a new user to an existing org
    var signupConfig = {
        platform_type: 'web',
        zaid: 10014774358
    };
    var userConfig = {
        last_name: 'Burrows',
        email_id: 'emma@zylker.com',
	zaaid: 10014774358
    };

Add a New User to Existing Org

You can now add a new end-user to an existing organization using the code below. You must pass the JSON objects you created in the previous section as arguments to the addUserToOrg() method. This method handles the user sign-up process and returns a promise. This promise will be resolved to a JSON object.

The userManagement reference used in the code is the component instance created earlier.

Note: You will be able to add only 25 users in your application in the development environment. After you deploy your application to production, you can include any number of end-users in it.
Copiedlet userManagement = app.userManagement();
let addUserPromise = userManagement.addUserToOrg(signupConfig, userConfig); //Pass the JSON configurations to the method
addUserPromise.then(addedUser => { //Returns a promise
      console.log(addedUser);
});

A sample response that you will receive for each version is shown below:

Node.js

Copied{
  zaid: "1005634498",
  user_details: {
    zuid: "1005643749",
    zaaid: "1005641456",
    org_id: "1005641456",
    status: "ACTIVE",
    is_confirmed: false,
    email_id: "p.boyle@zylker.com",
    last_name: "Boyle",
    created_time: "Aug 12, 2021 03:56 PM",
    modified_time: "Aug 12, 2021 03:56 PM",
    invited_time: "Aug 12, 2021 03:56 PM",
    role_details: { role_name: "App User", role_id: "2305000000006024" },
    user_type: "App User",
    user_id: "2305000000009002",
    project_profiles: []
  },
  redirect_url: "https://aliencity-66446133.development.catalystserverless.com/app/",
  platform_type: "web",
  org_id: null
}
Copied{
  zaid: 1005634498,
  user_details: {
    zuid: 1005643930,
    zaaid: 1005641456,
    org_id: 1005641456,
    status: "ACTIVE",
    is_confirmed: false,
    email_id: "p.boyle@zylker.com",
    last_name: "Boyle",
    created_time: "Aug 12, 2021 04:05 PM",
    modified_time: "Aug 12, 2021 04:05 PM",
    invited_time: "Aug 12, 2021 04:05 PM",
    role_details: { role_name: "App User", role_id: 2305000000006024 },
    user_type: "App User",
    user_id: 2305000000009004,
    project_profiles: []
  },
  redirect_url: "https://aliencity-66446133.development.catalystserverless.com/app/",
  platform_type: "web",
  org_id: null
}