cancel
Showing results for 
Search instead for 
Did you mean: 

Pass variable to Javascript of Data Dictionary

lakshya
Champ in-the-making
Champ in-the-making
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/S...

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/S...&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….
2 REPLIES 2

mikeh
Star Contributor
Star Contributor
Remember: your JavaScript runtime is Rhino, not a web browser. Therefore browser-supplied root objects like "window" and "document" are meaningless.

Use args.noderef instead.

Mike

lakshya
Champ in-the-making
Champ in-the-making
Thanx a lot Mike.
It solved my problem Smiley Happy