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);
Solved! Go to Solution.
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"]);
}
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.
I don't know how to use that, can you give me an example?
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"]);
}
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.