cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Prefix in name of entities

SOLVED
Highlighted
Amethyst

Prefix in name of entities

hi all,

 

is it possible to setup thingworx in that way that all entities created by user will have some prefix in name? I have in ming something similar to OIR in Windchill.

 

thx in advance

Krzysztof
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Prefix in name of entities

Oh, that feature.  A bit of a warning - it's a hidden and unsupported feature that was added to the product specifically to address use cases unique to PTC's training environment.  This is an environment where hundreds of student-developers follow an exercise, creating entities with the same name and features.  The _username was added to avoid naming conflicts.  We did not conceive of customers having a need for this.

 

That said, you can turn this feature on in [tomcat_root]/webapps/Thingworx/config/buildConfig.json.

 

Add the following to the json file:

"enableEntityUserNameSuffix":true

 

That will turn on the feature.  However, be aware that this feature is quite limited - it only appends _username to entities created using ThingWorx Composer.  If you create your entities programmatically using services or import them, the suffix will not be added.

 

It is also obnoxious when creating users.  Most organizations like usernames to be email addresses, and the feature will append _username to the email address...  president@whithouse.gov_president is not a good username.

 

-->Adam

View solution in original post

11 REPLIES 11
Highlighted

Re: Prefix in name of entities

Hi,

 

Out of the box solution for that is not available.

Probably a custom setup can be done, but I do not have any idea.

 

Regards,

Raluca Edu

Highlighted

Re: Prefix in name of entities

hi,

 

for sure it's possible because as far as I remember during PTC course it was established. Question: how??

thx

Krzysztof
Highlighted

Re: Prefix in name of entities

Put the following code into your service:

 

var username = Resources["CurrentSessionInfo"].GetCurrentUser();

 

-->Adam

Highlighted

Re: Prefix in name of entities

@AdamM.Levine  - looks and works ok when service is executed - thanks.

 

But iI wanted to setup thx in that way that after user types name in UI, in background some postfix will be added.

 

Krzysztof
Highlighted

Re: Prefix in name of entities

I remember that and was also wondering how that works. E. g. if I created an entity called "HelloTestTemplate" it automatically appended the user name and the actual entity name became "HelloTestTemplate_bbeuckSIG".

Highlighted

Re: Prefix in name of entities

Oh, that feature.  A bit of a warning - it's a hidden and unsupported feature that was added to the product specifically to address use cases unique to PTC's training environment.  This is an environment where hundreds of student-developers follow an exercise, creating entities with the same name and features.  The _username was added to avoid naming conflicts.  We did not conceive of customers having a need for this.

 

That said, you can turn this feature on in [tomcat_root]/webapps/Thingworx/config/buildConfig.json.

 

Add the following to the json file:

"enableEntityUserNameSuffix":true

 

That will turn on the feature.  However, be aware that this feature is quite limited - it only appends _username to entities created using ThingWorx Composer.  If you create your entities programmatically using services or import them, the suffix will not be added.

 

It is also obnoxious when creating users.  Most organizations like usernames to be email addresses, and the feature will append _username to the email address...  president@whithouse.gov_president is not a good username.

 

-->Adam

View solution in original post

Highlighted

Re: Prefix in name of entities

@AdamM.Levine 

thanks for your answer and deep explanation, but unfortunately in my test environment it is not working.

Maybe in my version it is deprecated and isn't working at all.

 

My buildConfig.json looks as follow:

 

{
"copyright": "Copyright \u00a9 2019 PTC Inc. and/or Its Subsidiary Companies. All rights reserved",
"helpCenterLink": "http://support.ptc.com/help/thingworx_hc/thingworx_8_hc/",
"productName": "ThingWorx",
"theme": "twx-default",
"version": "8.5.3-b123",
"enableEntityUserNameSuffix":true
}

 

regards

Krzysztof
Highlighted

Re: Prefix in name of entities

I don’t have an answer for that, other than perhaps bouncing the server.

Also, PTCUniversity isn’t using that feature anymore – those tutorials are going to be retired, and we aren’t updating the training environment past ThingWorx 8.3. It could be they removed the feature after that, though I am not sure.

-->Adam
Highlighted

Re: Prefix in name of entities

Ok @AdamM.Levine - thx for your help.

Krzysztof
Highlighted

Re: Prefix in name of entities

One thing I forgot to mention.  It doesn't append the username if you are the Administrator user.  That could be it.

 

-->Adam

Highlighted

Re: Prefix in name of entities

Bingo - all the time I did test as administrator. As a "normal" user - your solution works perfectly. It is what I was looking for.

 

Thanks, @AdamM.Levine  I really appreciate your knowledge & time.

Krzysztof
Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!