cancel
Showing results for 
Search instead for 
Did you mean: 

Error when Post Activity with 'parentNodeRef'

sunquanbin
Champ on-the-rise
Champ on-the-rise
Hi, I have encountered a error when try to post a share activity (use Alfresco.Share.postActivity(…)) by providing a "parentNodeRef" rathan "nodeRef" in the data object.

"Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/slingshot/activity/create-activity.post.json.js': 06222020 JSONObject["nodeRef"] not found."   

After had a look at the actual alfresco webscript (create-activity.post.json.js) get called, I have noticed the following code:


   /**
    * NodeRef & ParentNodeRef properties (must have at least one)
    */
   if (json.has("nodeRef"))
   {
      nodeRef = json.get("nodeRef");
      data.nodeRef = nodeRef;
      m_node = search.findNode(nodeRef);
   }
   if (json.has("parentNodeRef"))
   {
      parentNodeRef = json.get("nodeRef");
      data.parentNodeRef = parentNodeRef;
      m_parentNode = search.findNode(parentNodeRef);
   }
   if (nodeRef == null && parentNodeRef == null)
   {
      status.setCode(status.STATUS_BAD_REQUEST, "Must specify either 'nodeRef' or 'parentNodeRef' parameter when posting activity");
      return;
   }


It looks that the code "parentNodeRef = json.get("nodeRef")" should be "parentNodeRef = json.get("parentNodeRef")" ? It is a bug in Alfresco or I'm not using it correctly?

Regards,
2 REPLIES 2

kaynezhang
World-Class Innovator
World-Class Innovator
I guess it is a bug ,you can submit an issue in Alfresco Jira and trace the feedback.

sunquanbin
Champ on-the-rise
Champ on-the-rise
This bug will be fixed in v5.0. https://issues.alfresco.com/jira/browse/ACE-2314