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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Prefix in name of entities

Gucio
14-Alexandrite

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

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
raluca_edu
17-Peridot
(To:Gucio)

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

Gucio
14-Alexandrite
(To:raluca_edu)

hi,

 

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

thx

Krzysztof

Put the following code into your service:

 

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

 

-->Adam

Gucio
14-Alexandrite
(To:AdamM.Levine)

@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
bbeuckSIG
15-Moonstone
(To:Gucio)

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".

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

Gucio
14-Alexandrite
(To:AdamM.Levine)

@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

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
Gucio
14-Alexandrite
(To:AdamM.Levine)

Ok @AdamM.Levine - thx for your help.

Krzysztof

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

 

-->Adam

Gucio
14-Alexandrite
(To:AdamM.Levine)

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
Top Tags