AnsweredAssumed Answered

Error when Post Activity with 'parentNodeRef'

Question asked by sunquanbin on Jul 22, 2014
Latest reply on Aug 4, 2014 by sunquanbin
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/': 06222020 JSONObject["nodeRef"] not found."   

After had a look at the actual alfresco webscript ( 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");

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?