Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Is there any way to obtain list of all SystemObjects that exists in Thingworx?
I would like to set specific permissions on all SystemObjects and I definetlly don't want to do it manually
Solved! Go to Solution.
Hi Jacek,
Maybe better you go with this service ( which should be faster than previous one ):
var result = Resources["SearchFunctions"].SpotlightSearch({
maxItems: 1000000 ,
types: { items: ["Thing",
"ThingShape",
"ThingTemplate",
"DataShape",
"Network",
"ModelTagVocabulary",
"Mashup",
"Menu",
"MediaEntity",
"StyleDefinition",
"StateDefinition",
"DataTagVocabulary",
"Group",
"User",
"ApplicationKey",
"Resource",
"Organization",
"Dashboard"
]},
aspects: { isSystemObject: true },
maxSearchItems: 1000000
});
for each (row in result.rows) {
// -- Do Whatever the the row.name entity
}
Pai Chung Can you update this article https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS241962 with the above code, I think it's better.
Best Regards,
Carles
Each Entity carries isSystemObject
You might be able to leverage one of the SearchFunctions and use that Property in conjunction.
This snippet might help:
var types = Resources["Tagger"].GetEntityTypes();
for (var x = 0; x < types.rows.length; x++) {
var row = types.rows
var entities = Resources["EntityServices"].GetEntityList({type: row.name});
for (var y = 0; y < entities.rows.length; y++) {
var entity = entities.rows
if (entity.isSystemObject) {
logger.info("System object : " + entity.name);
// Do whatever here
} else {
logger.info("Not a system object : " + entity.name);
}
}
}
Hello Sajid,
Unfortunatelly I do not have resource "Tagger" in my TWX 7.1. Is this something from older version or customization?
Hi Jacek,
Maybe better you go with this service ( which should be faster than previous one ):
var result = Resources["SearchFunctions"].SpotlightSearch({
maxItems: 1000000 ,
types: { items: ["Thing",
"ThingShape",
"ThingTemplate",
"DataShape",
"Network",
"ModelTagVocabulary",
"Mashup",
"Menu",
"MediaEntity",
"StyleDefinition",
"StateDefinition",
"DataTagVocabulary",
"Group",
"User",
"ApplicationKey",
"Resource",
"Organization",
"Dashboard"
]},
aspects: { isSystemObject: true },
maxSearchItems: 1000000
});
for each (row in result.rows) {
// -- Do Whatever the the row.name entity
}
Pai Chung Can you update this article https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS241962 with the above code, I think it's better.
Best Regards,
Carles
Thank you Carlos! It works as expected.
Yes, just realized that it is a customized resource. Anyways, Carles's answer is more generic.