cancel
Showing results for 
Search instead for 
Did you mean: 

Task Link in Email

preetigupta
Champ in-the-making
Champ in-the-making
Hello,

I have to send an email to task assignee on creation of task.
I have included the following code which works find and sends the mail:

var mail = actions.create("mail");                
                       mail.parameters.to = bpm_assignee.properties.email;
                       mail.parameters.subject = "Test Document Task " + bpm_workflowDescription;
                       mail.parameters.from = initiator.properties.email;
                       mail.parameters.text = "You have a TASK " ;
                       mail.execute(bpm_package); 

My requirement is to include the task link in the mail body, so that when user clicks on that link, after login, user should be navigated to that task straight away.
User should not click on My Alfresco and then search for the task.

Could you please help me in getting the link straight to task.

Thanks and Regards
Preeti Gupta
9 REPLIES 9

jayjayecl
Confirmed Champ
Confirmed Champ
Hi,

there is some link in the "mytaskspanel.get.html.ftl" (for "My Tasks" dashboard) that gives the URL to manage a selected task.
Have a look at it


<a href="#" onclick="event.cancelBubble=true; openWindowCallback('${url.context}/command/ui/managetask?id=${pooled.id}&amp;type=${pooled.qnameType}&amp;container=plain', MyTasks.manageTaskCallback);">

You can dig a little around this command processor "managetask" to find away to put the URL you need in the mail body

sanatmastan
Champ in-the-making
Champ in-the-making
Hi even i am looking solution for same issue, as JayJayECL said to look for ${url.context} i digged in to it little bit and found that url object is available for Templating script not in the javascript, did you anyone able to break through it?

Thanks in advance

golden_eye
Champ in-the-making
Champ in-the-making
Hi i need the same functionality.
I am using a template,but there am getting the error
Failed to send email to [me]
org.springframework.mail.MailPreparationException: Could not prepare mail; nested exception is org.alfresco.service.cmr.repository.TemplateException: 09200004 Error during processing of the template 'Expression url is undefined on line 12, column 23 in workspace://SpacesStore/07f7676f-b933-4191-bdb7-0fcf8ce32919.

How can i define url for task to get direct link inside alfresco gui?

jayjayecl
Confirmed Champ
Confirmed Champ
you have to fork the java class that sends the email in order to provide to the FTL model the variable URL

nitinkcv
Champ in-the-making
Champ in-the-making
Hi,

Could you please elaborate more when you say
fork the java class
.

Thanks.

jayjayecl
Confirmed Champ
Confirmed Champ
could please show your process definition file, or at least the part when the email sending is exposed

golden_eye
Champ in-the-making
Champ in-the-making
I am using these code inside workflow to send mail

<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
        <script>
        {
         var mail = actions.create("mail");
         mail.parameters.to = bpm_assignee.properties.email;
         mail.parameters.subject = " You have new document to approve ";
         mail.parameters.from = initiator.properties.email;
         mail.parameters.text =" Access to document is under My Task To Do \n\n ";

         mail.parameters.text +="Access to document: http://servername:8080/alfresco/faces/jsp/login.jsp";
     
   //here i want change login.jsp to show direct link to document and attached metadata
   <!– mail.parameters.text +="Access to document: http://servername:8080/alfresco/${bpm_package.children.url} ";
  –>
  <!– mail.parameters.text += document.url;–>

         mail.execute(bpm_package);
         }
         </script>
</action>

jayjayecl
Confirmed Champ
Confirmed Champ
The "MailActionExecuter.java" class has to be customized.
And your script too : you have to specify a mail template, instead of a text content, so that you'll be able to use variables.

Here is the part of the code where the mail template is used :

// See if an email template has been specified
                String text = null;
                NodeRef templateRef = (NodeRef)ruleAction.getParameterValue(PARAM_TEMPLATE);
                if (templateRef != null)
                {
                    // build the email template model
                    Map<String, Object> model = createEmailTemplateModel(actionedUponNodeRef);
                   
                    // process the template against the model
                    text = templateService.processTemplate("freemarker", templateRef.toString(), model);
                }
               

The "model" variable is a Map of <key, value>.
In your case, you'd like to have the {servername} key, like :

Access to document is under My Task To Do \n\n
Access to document: http://{servername}:8080/alfresco/faces/jsp/login.jsp

pp20218
Champ in-the-making
Champ in-the-making
I have the same req, Can anyone help me pls?

Thanks in advance!!!
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.