Skip to main content
15-Moonstone
March 16, 2021
Question

Creating Users from service - Issue creating Users

  • March 16, 2021
  • 2 replies
  • 3819 views

Hi, 

I am creating users from service, I using now CreateUserWithOptions() from EntityServices.. 

after executing my service I am able to see users by using this service(custom service from ptc found via article - https://www.ptc.com/en/support/article/CS176431 )

 

```````

var params = {
tags: undefined /* TAGS */,
nameMask: undefined /* STRING */,
type: 'User' /* STRING */,
maxItems: undefined /* NUMBER */
};

// result: INFOTABLE dataShape: RootEntityList
var result = Resources["EntityServices"].GetEntityList(params);

``````

But not able to see users from composer and in users section too, if I search particular user which I created I am getting no results found in search box.

Also, I am not able to delete the user through service.

2 replies

17-Peridot
March 16, 2021
sabharees15-MoonstoneAuthor
15-Moonstone
March 16, 2021

Hi Max,


I already following this method to create users, but I am not able to find users in composers.
also, I tried to delete users, deletion also not happening I am not able get username tried GetPropertyValues() also...
Users["testuser4@sabharees.com"].GetPropertyValues();

sabhz_0-1615878842396.png

 



16-Pearl
March 16, 2021

@sabharees 

 

Please import the attached entity on your instance. After executing the service createUsers I am able to see the testUser1 on Users screen in composer(refer screenshot). I am able to delete the user as well after executing DeleteUser service. I tested on Thingworx 9.1.

After importing the entity, execute the services and let me know if the user gets created and is visible on Users screen or not.

SachinSharma_0-1615880157092.png

 

sabharees15-MoonstoneAuthor
15-Moonstone
March 16, 2021

Hi Sachin, 

 

Thanks for this... previously I created users without username I perhaps because of that only I am not able to delete users. 

Please let me know to update username property by using anyother method, if i use default update method It will ask username. In my case it is null now because of this I am not able to update users.

16-Pearl
March 16, 2021

@sabharees 

 

When you try to create a user without providing username it gives an error with both CreateUser and CreateUserWithOptions services, so how did you create users without username? There is a service UpdateUserWithOptions but it requires userName param. I don't think there is any other OOTB service to update the user properties.

Since, the username field is unique you can create new users if they haven't been created already and use the username field to fetch their records.