cancel
Showing results for 
Search instead for 
Did you mean: 

Data list assignee variable to run script

efvrvo
Champ on-the-rise
Champ on-the-rise
Hi

I want to run a script that will start a workflow every time I create a Issue in th eissue list. I created the rule and the script and everything works if the script looks as follows

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:adhoc";
workflow.parameters["bpm:workflowDescription"] = document.properties.name+"-"+ document.properties.title + " - " + document.properties.description;
workflow.parameters["bpm:assignee"] = people.getPerson("admin");
workflow.execute(document);

I now want to change the workflow.parameters["bpm:assignee"] = people.getPerson("admin"); so that it picks up the "assigned to" value in the issue list. Thus when I create a issue and assign it to a user it will start an adhoc workflow against that user. Can anybody help me with this problem
5 REPLIES 5

pavaniakella
Champ in-the-making
Champ in-the-making
Hi,

Assigned to in the issue datalist is a association
so this is how you need to get the username from the association
var person=document.assocs["dl:issueAssignedTo"][0];
var username=person.properties["{http://www.alfresco.org/model/content/1.0}userName"];

Now you can use the username as variable to people.getPerson() as
 people.getPerson(username);
Hope this helps

Regards,
Pavani

efvrvo
Champ on-the-rise
Champ on-the-rise
Thanks alot you have made my day.

We are using this feature now in an engineering project enviroment so that once we have a change order we can log it in the data list and then assign an engineer to the task (workflow).

n_blessing
Champ in-the-making
Champ in-the-making
Hi,

Im new to Alfresco. My requirement is somewhat similar to yours. I want to start a Workflow whenever i create my new custom datalist. I understood from your post that it is possible by creating a rule and  script. But im not sure how to do it. Can you please help me on this. A tutorial or a detailed reply would help on this.

pavaniakella
Champ in-the-making
Champ in-the-making
Hi
Create a script and upload the script into scripts folder in Data Dictionary. No go to data lists folder  in the site you have created and go to the folder that is your custom datalist. Now create rule on that folder to execute the created script on every new item into the folder.
Hope this helps.

Regards,
Pavani

krups
Champ in-the-making
Champ in-the-making
Hi I am wondering how did you set rule?
I mean what condition did you applied to check datalist?