cancel
Showing results for 
Search instead for 
Did you mean: 

I am a newcomer in alfrsco, I have the following questions in the process of use I want to customize a process, when a file into the folder, start the approval process, when all the approval process through after into the folder, rejected not into this fo

guoh1988
Champ on-the-rise
Champ on-the-rise

I am a newcomer in alfrsco, I have the following questions in the process of use
I want to customize a process, when a file into the folder, start the approval process, when all the approval process through after into the folder, rejected not into this folder

12 REPLIES 12

kaynezhang
World-Class Innovator
World-Class Innovator

HI

I know this rule, but this rule is too simple, I hope the file into the formulation for examination and approval of personnel, cannot be read without approval document, only approved documents folder

kaynezhang
World-Class Innovator
World-Class Innovator

you can run your customized JavaScript action or java action in your rule

thks 

now I can run JS by executing  script,but sendEMailNotifications not work  Dynamic start-up process is mail function can be used

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiReview";

workflow.parameters["bpm:workflowDescription"] = "Please assign approver for "+ document.name;

workflow.parameters['bpm:assignee']=people.getPerson("username");

workflow.parameters["sendEMailNotifications"] = true;

workflow.execute(document);

Data dictionary already have a start - polled - review - workflow. Js
I put the rule set to execute the script but he won't do anything,

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();

kaynezhang
World-Class Innovator
World-Class Innovator

try bpm:sendEMailNotifications

Still can't receive email notification ,Because I can't write a script, can you help me to write a script, meet after entering folder to start the approval process can enter the folder, because I now use the JS file regardless of process or refusing to file into the folder

kaynezhang
World-Class Innovator
World-Class Innovator

In order to send email notifications,you also need to configure SMTP properties.
Please refer to https://community.alfresco.com/docs/DOC-4799-outbound-e-mail-configuration

I have already  configure SMTP  properties,I can receive the mail by starting the task process,but  Perform the following JS file cannot be received mail 

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiReview";

workflow.parameters["bpm:workflowDescription"] = "Please assign approver for "+ document.name;

workflow.parameters['bpm:assignee']=people.getPerson("username");

workflow.parameters["bpm:sendEMailNotifications"] = true;

workflow.execute(document);

kaynezhang
World-Class Innovator
World-Class Innovator

start-workflow action will not send email,parameter bpm:sendEMailNotifications = true is useless in start-workflow action ,it is only used when a task is created.
You can try to execute an mail action in your javascript code
var mail = actions.create('mail');
mail.parameters.to = '';
mail.parameters.subject = 'Hello from JavaScript'
mail.execute(document);