Axeda Groovy Script: Deleting Contacts Without Assets
This script will get all contacts (optionally limited to a particular organization) and check whether there is a DeviceContact associated with it. If there is no DeviceContact (meaning it is not associated with a device), it deletes the contact.
Note - It is worthwhile to test this script by commenting out the contact.delete() line first and reviewing which contacts will be deleted. Also, this script works by finding all contacts, therefore it is not recommended to run the script repeatedly within a short period of time.
organizationName (OPTIONAL) - Str - the name of the organization