Groovy Script: Add an asset to an asset group

This code snippet shows how to add an existing Device to an existing DeviceGroup using a custom Groovy script executed by the Scripto web service. To call the script create a URL of the following form:

http://<HOST>/services/v1/rest/Scripto/execute/addDeviceToDeviceGroup?us...

Text in angled brackets (< >) indicates a variable.

 

Alternatively, this script can be called by an Expression Rule using the following form:

If: Registration.first

Then: ExecuteCustomObject("addDeviceToDeviceGroup","<ASSET_ID>","<GROUP_NAME>")

It is worth noting that it is important when creating the Groovy script that the parameters be created in the order of the parameter list.

 

Keywords: