Axeda Groovy Script: Getting a list of device groups based on a deviceID

    This groovy script will return a list of DeviceGroups based off a given Asset's serialnumber.

     

    import com.axeda.drm.sdk.device.*;
    import com.axeda.drm.sdk.Context;
    
    Context sysContext = Context.create();
    DeviceGroupFinder dgf = new DeviceGroupFinder(sysContext);
    DeviceFinder devFinder = new DeviceFinder(sysContext);
    
    devFinder.setSerialNumber("[your serialnumber here]");
    Device myDevice= devFinder.find();
    
    dgf.setDeviceId(myDevice.getId());
    List<DeviceGroup> allGroups = dgf.findAll();
    
    allGroups.each
    { group ->
    logger.debug(group.getName());
    }