Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
I'm trying to programmatically create a few dummy users in Thingworx for a demo. I'm able to easily create them using EntityServices.CreateUser, but there doesn't seem to be a service to disable the created user either on EntityServices or on the User object itself. How can I accomplish that on release 5.4?
Solved! Go to Solution.
This will be available in the next release I believe.
This will be available in the next release I believe.
@Pai, do you have are release date for this feature? I am also interested in this feature.
This is in the latest 7.x release part of the user Object. EnableUser and DisableUser
@Pai
I do not have older versions of TWX, but am able to create, disable and enable users using following snippets in Thingworx 7.1
// To create an user
var params = {
password: <password> /* STRING */,
name: <name> /* STRING */,
description: <description> /* STRING */,
tags: undefined /* TAGS */
};
Resources["EntityServices"].CreateUser(params);
// To disable an enabled user
Users[<username>].DisableUser();
// To enable a disabled user
Users[<username>].EnableUser();
True but it does not create the user as disabled. The user is created as "enabled" than you disable it.
By the way, how can I know if a user is disabled or enabled from within a service. Is there a property I can check or a service like the one "IsEnabled" available for Things?
In Release 7.1, I see that it is possible to check as follows:
var enabled = Users[<username>].IsEnabled();
True, I see it now in 7.1
Thanks Sajid