AnsweredAssumed Answered

Pass variable to Javascript of Data Dictionary

Question asked by lakshya on Jul 20, 2009
Latest reply on Jul 20, 2009 by lakshya
Hello,
I am using RESTful API to execute javascript that I placed in Company Home/Data Dictionary/Scripts

http://localhost:8080/alfresco/command/script/execute?scriptPath=/Company%20Home/Data%20Dictionary/Scripts/workflow.js

My script is
function initWorkflow()
{
   var noderef = 'workspace://SpacesStore/577a1596-556f-44df-b3b0-779278ea6191';
   var wflow = actions.create("start-workflow");
   wflow.parameters.workflowName = "jbpm$wf:review";
   wflow.parameters["bpm:assignee"] = person.properties.userName;
   wflow.parameters["bpm:workflowDescription"]  = "Put your description";
   wflow.execute(search.findNode(noderef));
}

initWorkflow();

I need to pass noderef from url like
http://localhost:8080/alfresco/command/script/execute?scriptPath=/Company%20Home/Data%20Dictionary/Scripts/workflow.js&noderef='workspace://SpacesStore/577a1596-556f-44df-b3b0-779278ea6191'

How can I fetch it in javascript?????

I tried with
   var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
and
        var hasQueryString = document.URL.indexOf('?');

but script is not able to resolve  'window' or 'document'.

Any help will be appreciated….

Outcomes