AnsweredAssumed Answered

Execute a custom javascript in workflow-form.js

Question asked by rubiecasana on Oct 9, 2012
Latest reply on Oct 12, 2012 by rubiecasana
I tried to create custom script that I want to call if the workflow status is complete. In the workflow-form.js, I am already able to know the status of the workflow. So I created an if statement that executes the script below. But it's not working. (Note: the script below is working when run in the javascript  console)

var nodeId = document.id;

var url = encodeURIComponent(document.nodeRef);
//nodeId = "ee9e3698-f6f7-438f-8f58-1015e37c7fc9";
var theDocument = search.findNode("workspace://SpacesStore/" + nodeId);
//logger.log(theDocument);

var cats = theDocument.properties["cm:categories"];
var summary = theDocument.properties["cm:summary"];

theDocument.properties["cm:summary"] = "Approved";
//var summary = theDocument.properties["cm:summary"];
theDocument.save();

Anyone's help is very much appreciated.

Outcomes