cancel
Showing results for 
Search instead for 
Did you mean: 

workflow.execute argument

akurutin
Champ in-the-making
Champ in-the-making
Hello 2 all.
Сreated a custom data list with assoc:


       <association name="dl:docContractFile">
            <title>Contract file</title>
            <source>
               <mandatory>true</mandatory>
               <many>false</many>
            </source>
            <target>
               <class>cm:cmobject</class>
               <mandatory>true</mandatory>
               <many>false</many>
            </target>
         </association>


share-datalist-form-config.xml:

            <field id="dl:docContractFile">
               <control>
                  <control-param name="startLocation">{doclib}</control-param>
               </control>
            </field>


Created a rule on new item in custom data list to execute that script:


var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiParallelReview";
workflow.parameters["wf:requiredApprovePercent"] = 100;
workflow.parameters["bpm:workflowDescription"] = "\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u0439\u0442\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 ";
workflow.parameters["bpm:assignees"] = document.assocs["dl:docTaskAssignees"];
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.parameters["bpm:sendEMailNotifications"] = true;
workflow.execute(document);


All working fine, but there is one question: how to use the attachment(dl:docContractFile)  instead of an document?

When i tried :
 workflow.execute(document.assocs["dl:docContractFile"]);

then got an error
<blockquote>
org.alfresco.scripts.ScriptException: 04222986 Failed to execute script 'workspace://SpacesStore/e0642e7d-84d3-4058-b541-e5b26f00204c': 04222985 Can't find method org.alfresco.repo.jscript.ScriptAction.execute(object). (workspace://SpacesStore/e0642e7d-84d3-4 … f00204c#10)

</blockquote>
2 REPLIES 2

ruchin78
Champ in-the-making
Champ in-the-making
Hi Everyone,

I am using the below code:
—–
function startWorkflow(assigneeGroup)
{
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiReviewPooled";
workflow.parameters["bpm:workflowDescription"] = "Please review " + document.name;
workflow.parameters["bpm:groupAssignee"] = assigneeGroup;
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
return workflow.execute(document);
}

function main()
{
var name = document.name;
var siteName = document.siteShortName;

if (siteName == null)
{
if (logger.isLoggingEnabled())
logger.log("Did not start workflow as the document named " + name + " is not located within a site.");

return;
}

var reviewGroup = "GROUP_site_" + siteName;

// make sure the group exists
var group = people.getGroup(reviewGroup);
if (group != null)
{
if (logger.isLoggingEnabled())
logger.log("Starting pooled review and approve workflow for document named " + name + " assigned to group " + reviewGroup);

startWorkflow(group);

if (logger.isLoggingEnabled())
logger.log("Started pooled review and approve workflow for document named " + name + " assigned to group " + reviewGroup);
}
else if (logger.isLoggingEnabled())
{
logger.log("Did not start workflow as the group " + reviewGroup + " could not be found.");
}
}

main();
—————–
It is all working fine, but I want something more in it.
For example a user added a file called DCN10007.pdf and other supporting files of DCN10007.pdf user will tag the filename under each supporting file say for example.
XYZ.docx
ABC.XLSX
As both the above files are supporting documents of DCN10007.pdf, then user will add tag as "DCN10007" in both of the documents.

Now, I want that when a file with the name DCN is uploaded I get workflow created for all the 3 documents.
I appreciate, if anyone can tell me how to achieve this.

Regards
Ruchin Sharma

tim1234
Champ on-the-rise
Champ on-the-rise

Greetings, have you solved the issue? I am trying to get similar workflow working too and would like to seek some advice.