How to check 'DoesThingExists' in TWX 9.1 using script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to check 'DoesThingExists' in TWX 9.1 using script
Hi Team,
I was using TWX 8.3 version earlier which was having below snippet:-
var params = {
thingName: thingName /* STRING */
};
// result: BOOLEAN
var result = Resources["PTC.Factory.CommonUtilities"].DoesThingExists(params);
But in ThingWorx 9.1, PTC.Factory.CommonUtilities is not available.
How would I run my code now?
Please provide snippet for ThingWorx 9.1 for checking the existence of Thing in the composer.
Thanks in advance.
Solved! Go to Solution.
- Labels:
-
Coding
-
Examples
-
TWX Dev Portal
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @ranjank.
PTC.Factory.CommonUtilities sounds like ThingWorx Apps. Do you have Manufacturing or Service Apps installed?
As an alternative, you could do something like this:
try{​​
result = Things[thingName].name;
}​​
catch (err) {​​
result = "Thing does not exist";
}​​
You'll need to pass in the thingName you're looking for.
Regards.
--Sharon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @ranjank.
PTC.Factory.CommonUtilities sounds like ThingWorx Apps. Do you have Manufacturing or Service Apps installed?
As an alternative, you could do something like this:
try{​​
result = Things[thingName].name;
}​​
catch (err) {​​
result = "Thing does not exist";
}​​
You'll need to pass in the thingName you're looking for.
Regards.
--Sharon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @ranjank.
If the previous response answered your question, please mark it as the Accepted Solution for the benefit of others with the same question.
Regards.
--Sharon