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

Can the custom error message on a service(configuration) be localized

Highlighted
Regular Member

Can the custom error message on a service(configuration) be localized

Hi,

In TW 7.1 , I can enable "Show Error Notification" for a service in mashup.

If it is checked .... I can give a custom error message.

Can this message be localized.

Thanks

8 REPLIES 8

Re: Can the custom error message on a service(configuration) be localized

How are you showing the error notification? Which widget/service has that option?

Re: Can the custom error message on a service(configuration) be localized

If you go to configure Service as shown below. We are using Show Error Notification. But there doesn't seem to be any way to show localized message. I tried using token like this [[LocalizationToken]] but this too doesn't work.

Configure_service.png

Re: Can the custom error message on a service(configuration) be localized

Vivek, I don't think that can be localized at the moment, as it is not a property setting per se. For example, if you take a look at a widget like the Button, the labels or tooltips are usually localizable. This would be an improvement/ enhancement to the existing feature.

Re: Can the custom error message on a service(configuration) be localized

There are a few ways to do this actually.

Probably the easiest way is to use GetToken against the standard localization within Thingworx.

So you evaluate the error, assign a token, translate that.

Now you can use GetToken and that will return the localized language (since it uses CurrentUser as the context)

Then return that value either in a Throw or as a Result to display in the runtime mashup

Re: Can the custom error message on a service(configuration) be localized

Thanks Aanjan for taking time to reply to this thread. I have created a enhancement request with support for this.

Re: Can the custom error message on a service(configuration) be localized

Thanks Pai for brainstorming one of way to do it. If i understand your way correctly it wont work for me since I cant throw or return a result to display from the service since User doesn't have permissions itself ob the Thing to execute the service. And the exception as part of [server-message] comes from Thingworx core classes which I cant customize to have my own customized message which can be localized.

Re: Can the custom error message on a service(configuration) be localized

I don't see why you can't. The user being able to see [server-message] means it executed the service that generated the error.

If that is a system default service, then just create a wrapper service around it so you can do the throw.

Re: Can the custom error message on a service(configuration) be localized

Let me elaborate the usecase. We have start page. This page is rendered dynamically by collecting apps with help of service on a Thing. And apps are role based i.e. only if a user belongs to particular role and that role has been assigned permissions by the Administrator for a particular app only then does that role see any apps. For a User who has been not assigned any permissions for thing which collects apps, the service code will never be hit. And the server message that is being displayed in Status bar is like "Not Authorized for Service Invoke on this thing". And what we want to do is instead of that message, we want to show customized user friendly message which is localizable.