Skip to main content
1-Visitor
January 18, 2019
Solved

Display Service Response of Remote thing's Set Properties in Thingworx Mashup

  • January 18, 2019
  • 6 replies
  • 4232 views

I am trying to set properties of a remote thing from mashup dashboard.

I can set properties using one of the following

1.Mashup only service

-SetProperties

2.Snippets that can be called from custom service

-UpdatePropertyValues

-UpdateSubscribedPropertyValues

-SetPropertyValues

 

All of the above have output type NOTHING.I want to retrieve the output(i.e http response if any) and display error message in mashup if service call failed due to some reason. Eg: Edge device not connected or some custom error message from remote thing's script handler

 

Is there any way to retrieve the response/output when trying to set properties to remote thing from service?

 

Note:

Thingworx Composer displays error message when trying to set property from Thing's properties.Looking to implement  a similiar functionality from thingworx dashboard.

set-remote-prop-error.pngset-remote-prop-error1.png

Best answer by CarlesColl

On the custom service part, if you add a try{} catch(err) {} wrapping the SetPropertiesValues what you get?

6 replies

1-Visitor
January 19, 2019

If you click on Bindings button of the Service call on the mashup it will pop-up a window which allows you to set a optional pop-up for service call answer with:

 

  • Show Success Notifications
  • Show Error Notifications

 

That can be a way, another way could be to build your own custom service that sets the desired property and checks for remote connectivity and it returns as output a success message or a error message and you use this message (when error for instance) to pop-up a "Status Message" widget.

Ramkumar1-VisitorAuthor
1-Visitor
January 21, 2019

Currently I am using default service's 'Show success/error Notifications' from service configuration to display status message

 

I have used SetPropertyValues to set properties.

I need to know if SetPropertyValues failed due to some issue on the remote thing and identify error based on service response and show custom success/error message instead of using default message.

 

Also I am trying to call another service on SetPropertyValues service's ServiceInvokeCompleted event, which is not getting fired if SetPropertyValues fails(with 500 status code).

 

Is there any way to get a service's call status and response?

 

Note:

On using custom service, we still need to call one of the available snippets to set properties on the thing (output is NOTHING for all of those built-in snippets for setting properties). So still need to find a way to identify whether service succeeded/failed

1-Visitor
January 21, 2019

With the custom service approach you can check if the thing it's connected before calling the builtin service and act accordingly for instance.