AnsweredAssumed Answered

remote is not defined

Question asked by jeremiebal on Nov 4, 2014
Latest reply on Nov 6, 2014 by jeremiebal
Hi all

In a workflow i want to retrieve history of this workflow at each task.

So i created a javascript code that i tested on my javascript console on alfresco (admin tools). And it works perfectly !


var connector = remote.connect("alfresco");
var user = connector.call("ervice/api/login?u=admin&pw=password").toString();
var indexHeadFin = user.indexOf(">");
var ticket = user.substring(indexHeadFin+10);
var indexFin = ticket.indexOf("<");
ticket = ticket.substring(0, indexFin);

var result = connector.call("ervice/api/workflow-instances/activiti$121407?includeTasks=true&alf_ticket="+ticket);
logger.warn(result.toString());


So i put this one in my workflow in a taskListener of a UserTask.
But now, this one doesn't want to run.
I have this error "remote is not defined".

And yet i have added a key in "web-scripts-application-context.xml" like i see on the Net :


<bean id="webscripts.container" class="org.alfresco.repo.web.scripts.TenantRepositoryContainer" parent="webscripts.abstractcontainer" init-method="setup">
   <property name="configService" ref="webscripts.config" />
   <property name="name"><value>Repository</value></property>
   <property name="scriptObjects">
      <map merge="true">
         …
         <entry key="remote">
            <ref bean="webscripts.script.remote" />
         </entry>   
         …


My question : how can i define "remote" to use this one on javascript in a workflow ?

Thanks a lot !

Outcomes