Article - CS335269

How to Call JavaScript Service with Service Name Stored As Variable in ThingWorx

Modified: 10-Jun-2021   


Applies To

  • ThingWorx Platform 7.0 F000 to 9.1

Description

  • How to make a service call dynamically via storing the service name in a JavaScript variable
  • Is it possible to pass variable to the service name when executing a service
  • Below code doesn't call the service "testService" of testThing as expected
let serviceName = "testService";
Things["testThing"].serviceName;

 
This is a printer-friendly version of Article 335269 and may be out of date. For the latest version click CS335269