Skip to main content
Sep 4, 2019 9:33 AM UTC
Question

Change property value from service (javascript)

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

Sep 4, 2019 10:52 AM UTC

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

Sep 25, 2019 12:58 PM UTC

@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