AnsweredAssumed Answered

Add aspect using Client side javascript

Question asked by suman.nitt on Jan 10, 2014
Latest reply on Jan 12, 2014 by suman.nitt
I want to add custom aspect on a content if not added already when i click on document library action.

I used record.jsNode.hasAspect("cm:templatable"), to check whether the content has this aspect already. It worked.

But when i try to add the aspect like record.jsNode.addAspect("cm:templatable"), i get javascript error at client side that "addAspect" method is not available.

I have seen the following examples and this approach not worked for me. I believe all this can happen at server side java script.

var props = new Array(1);
props["cm:template"] = document.nodeRef;
document.addAspect("cm:templatable", props);

props = new Array(1);
props["cm:lockIsDeep"] = true;
document.addAspect("cm:lockable", props);

props = new Array(1);
props["cm:hits"] = 1;
document.addAspect("cm:countable", props);

I am looking for a way to add an aspect using client side javascript.