How to set document aspect property cm:person

Showing results for 
Search instead for 
Did you mean: 

How to set document aspect property cm:person

Established Member
0 0 1,086

I am using Alfresco community version: 5.2.0 (r135134-b14)

If you have document with aspect containing cmSmiley Tongueerson property.

      <aspect name="ad:approveDocument">
            <title>Approver for Approve document</title>
              <association name="ad:approver">
                  <class>cmSmiley Tongueerson</class>


When you start workflow on document with this aspect I can read property ad:approver

When you want to set property ad:approver you have to

private static final String adNamespace = "";

ServiceRegistry serviceRegistry = (ServiceRegistry)registeredBeans.get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);

NodeRef docref= serviceRegistry.getNodeService().getChildAssocs(packagenode).get(0).getChildRef();

String username = "myUser";

NodeRef person = personService.getPerson(username);

nodeService.setAssociations(docref, QName.createQName(adNamespace, "approver"), Arrays.asList(person));