Skip to main content
1-Visitor
May 6, 2020
Solved

POST JSON Service- Auto execution challenge

  • May 6, 2020
  • 1 reply
  • 4106 views

Hi Team,

May i ask your advice on POST JSON script in Thingworx.

I am facing a challenge to auto trigger the POST JSON script. My POST JSON script running very well when i execute it manually but it is not working with auto trigger.

I have connected it's execution with one of the property data change.

Even i have tried subscription- data change option and tag with the POST JSON script. But its not working. I have checked data is getting change in property.

Please suggest.

 

Thanks & regards,

Priyank

Best answer by priyank

Hello Janardan,

Thank you so much for all your support!

We have resolved the issue by providing the resources entity to System user as visbility and run mode.

 

we need to give system permission to Resources. which we are using in our POST JSON script.

var result= Resources["ContentLoaderFunctions"].PostJSON(params);

 

Regards,

Priyank

1 reply

12-Amethyst
May 7, 2020

Hi ,

 

What exactly the issue you are facing ? Did you check your subscription code is triggered on data change event  ?. You can check this by simply putting some logger statements  at the start of subscription code. Also , would  you please make sure subscription which you had written is marked enabled ?

priyank1-VisitorAuthor
1-Visitor
May 7, 2020

Hi,

 

Please find below the issue details and my testing so far-

I would like to get suggession from you..

Issue details- POST JSON service is mapped with one of the Subscription based on data change in respective property for automatic execution. But POST JSON service is not getting execute even on data changed in property.

 

But when we execute the POST JSON script manually, it successfully run.

 

Checked points so far-

  1. I have checked the Subscription is in enabled state.
  2. Subscription details verified- mapping of property and POST service.
  3. Data changes in related property are verified.
  4. We have configured the property and service in same entity(Thing) also and try but didn’t work.
  5. We have checked the Run type permissions to as enabled for System and Administrator.
  6. We have tried to link the POST JSON service’s execution in another service(example Service “A”) and we bind the related property with service “A” using subscription. So whenever the property changed, the Service ”A” executed automatically but POST JSON service didn’t execute.
  7. And when we execute Service “A” manually then POST JSON script also got execute automatically.
  8. We have tried loggers in subscription and in POST JSON service but not getting exact root-cause.

 

Thanks..

16-Pearl
May 7, 2020

I am assuming your subscription is listening to DataChange event of let's say Property1 and then setting JSON value to a JSON property Property2. 
Is there any error in the logs?

You have added log messages. Are these getting written i.e. is the subscription fired at all?

Instead of PostJSON could you try setting a simple property to a hard coded value in the subscription?