How to access Thingworx EntityUtilities methods
- August 28, 2018
- 1 reply
- 1811 views
Hello,
I have a requirement, to check if a particular entity (input - name, type) exists in Thingworx or not. For that, I came across 'EvaluateVisibilityPermissions'
var params = {
name: EntityName /* STRING */,
type: "MediaEntity" /* STRING */
};
// result: BOOLEAN
var isExist = Resources["SecurityServices"].EvaluateVisibilityPermission(params);
But this method comes with a limitation that, if the permission is not set to the user, this service returns false.
What I would like to have is check if the entity is present or not, regardless of visibility permissions.
For that I came across a resource https://support.ptc.com/cs/help/thingworx_hc/thingworx_7.0_hc/index.jspx?id=ID103384447&action=show 'Entity Utilities'.
This class (EntityUtilities) has a method, "findEntityDirect" which can solve my purpose, but I am not able to understand how to use this method in my custom Thingworx services. If I understand correctly it is similar to "EntityServices" (http://support.ptc.com/cs/help/thingworx_hc/thingworx_6.0_hc/index.jspx?id=ID1410648636&action=show). I am able to see 'EntityServices' while creating my custom service in snippets, but I cannot find 'EntityUtilities'. Refer attached image.
Please let me know how to get EntityUtilities class, so that I am able to use 'findEntityDirect' method.
Thanks in advance
Aditya Mittal

