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

How to check 'DoesThingExists' in TWX 9.1 using script

SOLVED
ranjank
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

Re: How to check 'DoesThingExists' in TWX 9.1 using script

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

Re: How to check 'DoesThingExists' in TWX 9.1 using script

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

Re: How to check 'DoesThingExists' in TWX 9.1 using script

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

Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.