Accessing data of the watch itself


(Willemdh) #1


We are working on some watches and wanted to add the condition threshold in hte output of the html email. Is there a way to access data of the watch itself somehow?

For example if this is the condition:

  "condition": {
    "compare": {
      "": {
        "gte": 2

How could we access the threshold key '' and value '2' so we can use this in for example an email action?



(Alexander Reelsen) #2

you can use mustache to access parts of the payload like {{}}


(Willemdh) #3


Yes, I know that, but data from the watch itself, such as the threshold in the condition is not in the payload...



(Alexander Reelsen) #4

this is true. The payload represents only the input itself. If you want to do that, you could store the threshold in the metadata and use a script condition and do sth like return > ctx.metadata.threshold


(Willemdh) #5


Ok, I see. And can I use the values in the metadata in the condition? Then I could add

"metadata" : { "threshold" : "5" }

And refer to it in the condition?

"condition" : { "compare" : { "" : { "gt" : {{ctx.metadata.threshold}} }}


(Alexander Reelsen) #6

just use a script condition like I did above instead of a compare and everything will work.

(Willemdh) #7

Alex, We were able to use the Metadata in the condition. Thanks!

(system) #8

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.