cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

How to check 'DoesThingExists' in TWX 9.1 using script

ranjank
14-Alexandrite

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.

1 ACCEPTED SOLUTION

Accepted Solutions
slangley
23-Emerald II
(To:ranjank)

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

View solution in original post

2 REPLIES 2
slangley
23-Emerald II
(To:ranjank)

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

slangley
23-Emerald II
(To:slangley)

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

Top Tags