cancel
Showing results for 
Search instead for 
Did you mean: 

Passing variables inside dashlet scripts

raptus
Champ in-the-making
Champ in-the-making
Hello,
I'd like to create a script that shows all workflows associated to a specific document, this is related to a document details page modification.
I have modified the document details page to show and modify metadata infos… Now I want to show the workflows related to that document.
I have already made the script to show all workflows (a really simple html - ftl script inside Alfresco without javascript controller) but now I want to put the condition that this script can shows workflows only if the "document details" document nodeRef is equal to the nodeRef of the workflow displayed.

But… how can I pass a variable into an another script inside a region?? Is it possible to do?? The nodeRef variable lives inside the document-details page, that page has a region called "test" that show the Alfresco script using the "alfresco" connector.
If this is possible I can put the condition inside the script ftl like this:
<if> "workflow.package = ${node}"…than show workflow infos</if> where "node" is the nodeRef passed by the document details page.

Thankyou all,
regards

Raptus
5 REPLIES 5

mikeh
Star Contributor
Star Contributor
${page.url.args.nodeRef}

Thanks,
Mike

raptus
Champ in-the-making
Champ in-the-making
Thank you for your precious help but I still have problems…
I am a beginner but when I try this code (my script is an HTML-FTL webscript without JS, I put it into the document details as a region-script component -  <@region id="test" scope="template" protected=true /> - this region is a component script that simply calls my alfresco script by the connector).
My alfresco "workflow-list" script:
<table cellspacing=0 cellpadding=2>

<#list workflow.assignedTasks as t>
<br/>

<#if t.package == "page.url.args.nodeRef">
<div class="task-transitions">
         <#list t.transitions as transition>
                 <li>
         <span class="link" <a href="http://localhost:8080/alfresco/service/api/workflow/task/end/${t.id}/${transition.id}?alf_method=pos... " title="transitions">${transition.label?html}</a></span>

</li>
                    </#list>
         </div> <#else>
</#if> 
      </#list>
</table>

I always get "error 500 - undefined term "page", I try also ${page.url.args.nodeRef} with and without " " but still get errors…. why?
Must I define a variable "page" inside the FTL or writing a javascript file? But… if so what is the correct javascript file?

Thankyou again…
regards,

Raptus

mikeh
Star Contributor
Star Contributor
The page.url.args.nodeRef statement should be on the web-tier, i.e. in the Share webscript that calls your remote one. You need to pass the nodeRef through to the Repository-tier webscript (the one you're seeing the problem with) and access it via args.nodeRef.

Thanks,
Mike

saravananshc
Champ in-the-making
Champ in-the-making
Hi Mike, Thank You for the reply and I spent almost 2 days ripping my hair to pass the parameter for dashlet and finally I found your reply for this post and it works.

I should have googled with correct keyword to get this thread. Anyhow it is going to be interesting for me from now.

1000 Thanks
Saran

raptus
Champ in-the-making
Champ in-the-making
Thanks for all your help…really appreciated!

Raptus