Issue Enabling User via API – SaveUser() Fails with “User Already Exists” Error
Hi!
We’ve developed a custom REST API in our OneStream application to automate user management. So far, the following methods are working successfully:
- CreateUser – Creates a new user
- DisableUser – Disables an existing user
Now, we are trying to add a new method:
EnableUser – This method receives a user name and sets the IsEnabled property to True.
The logic is quite simple. We retrieve the existing user using:
However, when we try to execute this method, we get the following error:
Problem enabling user, Error message:
Error saving User. 'Test' already exists.
This seems misleading because we're not trying to create a new user—we're retrieving an existing one and updating it. The createNewUser flag is explicitly set to False, and we are using the original UserInfo.User object returned by the API.
We’ve ensured that all key properties like Name, UserType, Email, etc., are populated.
It seems that SaveUser() is still attempting to create a new user instead of updating the existing one.
Has anyone encountered this behavior before? Is there a specific requirement or workaround to ensure SaveUser() correctly recognizes an update instead of a creation?
Any insights or guidance would be greatly appreciated.
Regards,
Xavi
In your SaveUser() call, you have set the fifth parameter, IsNew=True. I would think with it set True, it will try to create the user, rather than update the user.