cancel
Showing results for 
Search instead for 
Did you mean: 

The workflow doesn' t start

frank83
Champ in-the-making
Champ in-the-making
Hi I have a problem; i would start a Reject & Approve workflow only adding a content in a space. So I have used this code taken in wiki:

var workflow = actions.create("start-workflow"); 

workflow.parameters.workflowName = "jbpm$wf:review";

workflow.parameters["bpm:workflowDescription"] = "The attached documents have been uploaded . Please review within 3 days.";

workflow.parameters["bpm:assignee"] = "admin";

var futureDate = new Date();

futureDate.setDate(futureDate.getDate() + 3);

workflow.parameters["bpm:workflowDueDate"] = futureDate;

workflow.execute(document);

I saved it in DataDictionary/Scripts, then  the rule "Execute script" and so after creating the content in the space, the workflow doesn' start. Why?
I have to install something? An answer please.Sorry the inexperience.
Thanks
13 REPLIES 13

fbehfar
Champ on-the-rise
Champ on-the-rise
Hi,
have you created a rule, which will run the script during the uploading a file? if not:
create a rule, on the space that you want to add a content,
in the condition step select All item,
in the action step select "execute a JavaScript",
in the next windows select the script that you have added in the Scripts space.
it should work.
hope it helps,

FSB

fbehfar
Champ on-the-rise
Champ on-the-rise

frank83
Champ in-the-making
Champ in-the-making
hope this link could help you,
http://forums.alfresco.com/viewtopic.php?t=10441&sid=73ade78bb00c26e0a460f6e929648fd0

FSB


Hi, thanks for the answer; I have done all these steps that you say, but when i create the content, in the dashboard the workflow there isn' t.
Instead, using the others javascript, the rule(for example backup) starts as if Alfresco doesn' t understand bpm variabiles.
You have a solution?
Ah i have also this system error when i create the content:
"A system error happened during the operation: Unknown Exception in Transaction."

fbehfar
Champ on-the-rise
Champ on-the-rise
Hi,
instead of "All Item" condition, try the condition which means, adding new content (right now i dont have alfresco, you should wait till tomorrow for saying the exact condition name) but you can find it in the condition list.
it should work, becuase i did the same and it's working.
hope this one helps

FSB

frank83
Champ in-the-making
Champ in-the-making
Hi,
instead of "All Item" condition, try the condition which means, adding new content (right now i dont have alfresco, you should wait till tomorrow for saying the exact condition name) but you can find it in the condition list.
it should work, becuase i did the same and it's working.
hope this one helps

FSB

Hi, with all items i have this system error , while with the condition which i need (Select an item with a value in his name: *Final*) i haven' t system error but the workflow doesn' t start in the dashboard.
I added this "start-workflow.js" in DataDictionay/Scripts.
I selected it in the rule (Execute a script) with the condition about the type of the content, i added the content and then i go on the dashboard and i don't find anything. However i can wait till tomorrow. I need an help to complete my little project as soon as. Thanks again

fbehfar
Champ on-the-rise
Champ on-the-rise
Hi,
follow these steps in order:
1. create a script like these and add it to the DataDictionary>Scripts space

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:adhoc";
workflow.parameters["bpm:workflowDescription"] = "The attached document has been uploaded to Alfresco. Please review within 3 days.";
workflow.parameters["bpm:assignee"] = "admin";
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 3);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document);

2. create a rule in the space that you want to affect in that space
  2.1 in Conditions sptep select 'All Items' and click on set Values and Add
  2.2 in Action step select 'Execute a Script' and click on set Values and Add
  2.3 in the next step select the scipt that you have just added in script step
  2.4 in the Details step select the type as 'Inbound'
3. add a content in the space that you have just created a rule

after the third step you should see the task in the 'My task to do' list in the admin user.

hope it helps and works

FSB

frank83
Champ in-the-making
Champ in-the-making
Hi,
follow these steps in order:
1. create a script like these and add it to the DataDictionary>Scripts space

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:adhoc";
workflow.parameters["bpm:workflowDescription"] = "The attached document has been uploaded to Alfresco. Please review within 3 days.";
workflow.parameters["bpm:assignee"] = "admin";
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 3);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document);

2. create a rule in the space that you want to affect in that space
  2.1 in Conditions sptep select 'All Items' and click on set Values and Add
  2.2 in Action step select 'Execute a Script' and click on set Values and Add
  2.3 in the next step select the scipt that you have just added in script step
  2.4 in the Details step select the type as 'Inbound'
3. add a content in the space that you have just created a rule

after the third step you should see the task in the 'My task to do' list in the admin user.

hope it helps and works

FSB


Hi I' m Frank, I have followed all your steps but when i click finish in the "create content" i have the same system error      * A system error happened during the operation: Unknown Exception in Transaction.
I don' t understand, jbpm exists in Alfresco 2.1  . I have copied your start-workflow.js. I have to confgurate Alfresco in some way?I need of SVN HEAD? Help me  Thanks again

fbehfar
Champ on-the-rise
Champ on-the-rise
hi,
well I have no idea, do you have this version of alfresco 'Alfresco 2.9 Community labs'??
if you don't have download it from the following link:

http://sourceforge.net/project/showfiles.php?group_id=143373&package_id=157460&release_id=555679
for Windows, you can download Alfresco ECM as: AlfrescoCommunity-2.9.0dev-Setup.exe

would you send me the exact error form the error log file???
have you followed exactly the steps in order?
did you copy/past the script? be carefull they are case sensitive!

FSB

frank83
Champ in-the-making
Champ in-the-making
Hi FSB, do you know how i can do to attach all the content of the space in an automatic workflow? with this code i attach it only one…

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:adhoc";
workflow.parameters["bpm:workflowDescription"] = "The attached document has been uploaded to Alfresco. Please review within 3 days.";
workflow.parameters["bpm:assignee"] = "admin";
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 3);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document);
Thanks