24
Views
10
Comments
Multiple System Users Creation through excel in ODC
Application Type
Reactive

Hi all,

I’m looking for an approach to handle the following scenario:

I have a list of users in an Excel file. Once the file is uploaded, the system should create user accounts for each entry in the list. After the upload, any of the created users should be able to log in to the application.

Could you please suggest a suitable implementation approach?

2025-09-04 06-33-37
Nikhil___Vijay

Hello @Harshitha Sripadha 

Step 1: Create a Server Action to Process the Uploaded File

Create a server-side action that receives the binary data of the uploaded file. Use the ExcelToRecordList widget to extract and convert the Excel data into a structured record list, as illustrated in the referenced image.

Step 2: Add a Server Action to Initiate User Registration

Next, implement a server action named startUserRegistration. This action will use the previously recorded data to create system users. It should handle user creation logic, including validation and error handling, to ensure a smooth registration process.

"

Registers the user in the built-in identity provider by creating the user as inactive and setting a verification code. Synchronises the User entity with the identity provider.

Call the action FinishUserRegistration to activate the user and change the password. 

It throws an exception if the built-in identity provider is disabled for the current app.

"

Regards 
Nikhil Kumar Vijay

UserImage.jpg
Harshitha Sripadha

Hi @Nikhil___Vijay ,

I've been working on implementing this logic, and while the users are getting created successfully, I noticed that they appear with a "Registration Pending" status in the Users portal. Because of this, I'm unable to log in with any of the created users.

Could you please help me understand how to complete the registration or activate the users so they can log in?

If it’s not too much trouble, would you be able to share the OML file for this implementation? It would greatly assist me in understanding the complete flow and ensure that I’m aligning with the correct approach.

Thank you in advance for your support.

UserImage.jpg
Łukasz Kaproń

StartUserRegistration ServerAction has Output "VerificationCode". You can use it in FinishUserRegistration ServerAction.

2025-09-04 06-33-37
Nikhil___Vijay


After the registration the email will send to specific user like below image then he have to click on the get started button and then you can see the active user 

UserImage.jpg
Harshitha Sripadha

Is it possible to get the verification codes for bulk of users individually?


2025-09-04 06-33-37
Nikhil___Vijay

Yes whenever the action trigger it will send email to registered user 

UserImage.jpg
Łukasz Kaproń

Hi @Harshitha Sripadha 

Firstly, you should create ServerAction to process Excel file. You can use ExcelToRecordList widget or find forge component.

Then you can use ServerAction named "StartUserRegistration" 

Now you can create screen to finish user regisration with client action named "FinishUserRegistration"

Now user should be able to log in to the app.


If it is not enough ,you can use User and Access Management API. https://success.outsystems.com/documentation/outsystems_developer_cloud/odc_rest_apis/user_and_access_management_api/

2024-09-14 05-42-00
Ozan Can Çalı
Champion

Hi Harshitha,

I recently built an app for a customer for this purpose. With that, we can create/update users in ODC platform and assign them to desired enduser roles or groups all at once.

First, you'll need to start consuming the User Management API of the platform. You can find details about this API here: https://success.outsystems.com/documentation/outsystems_developer_cloud/odc_rest_apis/user_and_access_management_api

You can also take a look at the "Users Management" ODC Forge Component by OutSystems Labs. That is a sample app which has a library using that API. You can see an example flow of manually creating a user and assigning to desired roles.

After making the API endpoints ready to use, you can do the following:

1. Have an excel upload logic where a user can upload an excel file with 3 columns: User name, Email and Enduser Roles.

1.a. The Enduser Roles column can be a comma-separated value such as "{MyApp_Admin},{MyApp_Cashier},{MyApp_Reporter}".

2. Create the incoming users all at once with the Bulk Create operation of the API (endpoint: "/identity/v1/users/bulk").

3. All such API operations return an "OperationKey". Use that to save details of the bulk import in a new "UserOperations" entity. 

3.a. You can save the OperationId, who started the operation and when. You'll need this Key later to ask the API about the results of the bulk operation.

3.b. Also save the Roles, coming from the excel for each user, into a "UserOperations_Roles" entity with a relation to the main entity.

4. Have a timer such as "Timer_AssignUsersToRoles", which you will trigger right after bulk-creating the users and saving the operational details.

4.a. The reason for having a timer for this last part of assigning roles is that it can take longer for the API to finish all assignments, so we want this process to happen in the background. 

4.b. Also, creating the users (step 2) is an asynchronous process with the API. The good thing with the timer is that when it starts running, we can check if the latest bulk operation is successfully finished or not (i.e. users are created in the platform successfully) and if it is not, we can re-trigger the timer. At some point, the result will be successful and then we can start assigning the desired roles to the "successfully created" users.

5. To check the result of the bulk operation in the timer, you can use the "GetBulkUserProfileOperationStatus" method of the API (/identity/v1/users/bulk/{key}). The {key} you will provide to the method is the "OperationKey" that you had received and saved in the UserOperations entity in step 3.

6. That API call will return a status for each user that you tried to import. You can filter the successful ones and start assigning the roles to those users.

6.a. The desired roles per user are to be found in the UserOperations_Roles entity, where you had saved in step 3.b.

6.b. You can use the API method "/users/{key}/application-roles/{roleKey} " for this. "{key}" is the key of the user, which was returned in the GetBulkUserProfileOperationStatus method in step 5. The "{roleKey}" is the key of the ODC role.

6.c. The challenge there is that you had saved the role names in the UserOperations_Roles entity, and not the role keys. To find the role keys per name, you can do a groups query towards the API. So, you can call the "/identity/v1/application-roles?key={key}&assetKey={assetKey}&environmentKey={environmentKey}&nameContains={nameContains}&sort={sort}&limit={limit}&offset={offset}" method of the API and provide the role name in the "{nameContains}" parameter. It will return you the details of the Role, including the key.

6.d. Finally, use that key in the API method mentioned in step 6.b.

The timer flow should look similar to this:


Keep in mind that there is only 1 account record in ODC portal per user, which is used in all stages. We determine to which stage(s) a user has access by assigning the enduser roles/groups of the correct stages.


User Management APIs allow assignments to be done to any role/group in any stage, so handle with care! E.g. if you decide to use enduser groups instead of roles and you query the API method about groups to find the key of a group, you might need to pass the "EnvironmentKey" as well, otherwise you might get multiple enduser group keys (if you are using the same group name in all stages).


UserImage.jpg
Harshitha Sripadha

Hi @Ozan Can Çalı
If you don’t mind, and if it’s possible, could you please share the OML file for this implementation? It would really help me understand the approach better and ensure I’m not missing anything. 

2024-09-14 05-42-00
Ozan Can Çalı
Champion

Hi Harshitha,

Unfortunately I cannot share the implementation directly, but if I find some time, I will make it a more generic solution and upload in ODC Forge. I will let you know!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.