Skip to main content
1-Visitor
September 4, 2019
Question

Change property value from service (javascript)

  • September 4, 2019
  • 2 replies
  • 1372 views

Hi. Can I please see a simple example on how to change the value of a property from a javascript service? A property on the same thing the service is running on. I'm struggling a little on figuring this out and finding the proper documentation.

 

I can get the property object through the Things["TestThing"].GetPropertyDefinition() function but what then? How do I know the name of the thing that invoked the service? Must it be an input parameter 😞

 

2 replies

raluca_edu
17-Peridot
September 4, 2019

Hi,

 

A service is called from a Thing, so if you want to change the value of a property just use:

 

var my_value="test";

me.property_name=my_value;

 

Instead of me, you can use the name of any Thing you want.

 

Best regards,

Raluca Edu

16-Pearl
September 25, 2019

@binaryPUNCH 

Have you found a solution to your problem?  If so, please indicate the appropriate response as the Accepted Solution for the benefit of other Community members who have the same question.

 

-Vibhuti