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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Java exception

AC_9552412
11-Garnet

Java exception

Hello, I have the following error (JavaException: com.thingworx.common.exceptions.InvalidRequestException: Language preferences can be changed only by the user or an administrator ) when trying to change the language of a user. The service is in a thing for which all users have visibility but only the System user has permissions to run it. How can I solve it?

 

ACCEPTED SOLUTION

Accepted Solutions
TonyZhang
15-Moonstone
(To:AC_9552412)

@AC_9552412 

Are you trying to invoke a function called SetLanguagePreferences on user?

I tried calling this function in custom JS service with non-admin user and get the same error message except for not a JavaException (not sure how you are changing the user language exactly)

TonyZhang_1-1694675986975.png

TonyZhang_0-1694675691591.png

You will need to add the service executor to a system-defined user group: SecurityAdministrators to allow the user to access service SetLanguagePreferences.

See Help Center > Security Administrators Group section

 

Tony

View solution in original post

2 REPLIES 2
PaiChung
22-Sapphire I
(To:AC_9552412)

The users themselves have the permission to change the language preference.

Is it the actual user who is invoking this for themselves or are you trying to set it for a user?

I haven't had to deal with this for a while, but if you are doing it with the actual user and running into this issue,

then I think you can safely assign 'users' to that specific service.

TonyZhang
15-Moonstone
(To:AC_9552412)

@AC_9552412 

Are you trying to invoke a function called SetLanguagePreferences on user?

I tried calling this function in custom JS service with non-admin user and get the same error message except for not a JavaException (not sure how you are changing the user language exactly)

TonyZhang_1-1694675986975.png

TonyZhang_0-1694675691591.png

You will need to add the service executor to a system-defined user group: SecurityAdministrators to allow the user to access service SetLanguagePreferences.

See Help Center > Security Administrators Group section

 

Tony
Announcements


Top Tags