04-23-2019 06:24 AM
I want to get the Tags of my document (in javascript) so that i can execute a script:
example: If my document is tagged "test" execute the rest of my script .
I know it is possible via the rules of the folder, but i want it via javascript like the case with categories:
var cats = document.properties["cm:categories"];
for (var i = 0; i < cats.length ; i++){
var catName = cats[i].name;
}
I tried with this but it's not working:
List<String> tags = taggingService.getTags(document);
logger.log(tags);
04-24-2019 04:15 AM
Hi,
var tags = document.properties["cm:taggable"];
for (var i = 0; i < tags.length ; i++){
var tagNodeRef = tags[i];
logger.info('------------------------------------------- ' + tagNodeRef.properties["cm:name"]);
}
04-23-2019 11:30 AM
Hi,
you have to inspect the cm:taggable aspect. This aspect is bound to tag noderefs.
So document.properties["cm:taggable"] returns tag noderefs bound to the document node, such as the cm:categories aspect.
04-23-2019 01:47 PM
I don't know how to use that, can you give me an example?
04-24-2019 04:15 AM
Hi,
var tags = document.properties["cm:taggable"];
for (var i = 0; i < tags.length ; i++){
var tagNodeRef = tags[i];
logger.info('------------------------------------------- ' + tagNodeRef.properties["cm:name"]);
}
Explore our Alfresco products with the links below. Use labels to filter content by product module.