0
1

I've created a custom task mail process similar to the one in the JsfWorkflowUi. http://developer.axonivy.com/doc/latest/EngineGuideHtml/administration.html#administration-emailnotification-design

Unfortunately I'm not able to receive any task mail if I simulate a process that create a new task. But it works on a real engine...

asked 14.04.2016 at 10:58

SupportIvyTeam's gravatar image

SupportIvyTeam ♦♦
1.4k102118122
accept rate: 77%

edited 14.04.2016 at 11:32


Today with Axon.ivy 6.1 and older it's not possible to send task mails from the designer. The main blockers are:

  • the mail servlet (ch.ivyteam.ivy.webserver.internal.IvyMailServlet) which generates the content of the task mail is not bound at designer time.
  • tasks mails require the system application 'System' and its process model 'IvyCommons'. But at design time only one application 'Designer' is available

Other difficulties which can be fixed/configured:

  • the task mail sender job does not respect the designer mail preferences. therefore the system wide mail properties of the engine have to be modified e.g. in a utitlity process
  • the project that provides the task notification mail content process must be registered with an utitily process api call
  • the designer app does not send any task mails by default. however with a JsfWorkflowUi or similar a test user can override his mail settings and enable task mails for any new task.
  • the designer test user must have a mail address configured

sample utility code to enable mail sending in the designer:

package mailGenerator;

import ch.ivyteam.di.restricted.DiCore;
import ch.ivyteam.ivy.application.IApplication;
import ch.ivyteam.ivy.application.IApplicationConfigurationManager;
import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.ivy.security.IEMailNotificationSettings;
import ch.ivyteam.ivy.system.IProperty;
import ch.ivyteam.ivy.workflow.StandardProcessType;

/**
 * Enable task mails in the designer to be generated with the JsfWorkflowUi
 */
public class DesignerMailUtitily {

    public static void configure()
    {
        configureEngineMailProperties();
        enableDesignerApplicationMails();
        useMailProcessFromJsfWorkflowUi();
    }

    private static void useMailProcessFromJsfWorkflowUi() {
        Ivy.wf().setStandardProcessImplementationLibrary(
                StandardProcessType.MailNotificationNewTask, "JsfWorkflowUi");
    }

    private static void enableDesignerApplicationMails() {
        IApplication designerApp = Ivy.wf().getApplication();
        IEMailNotificationSettings mailSettings = designerApp.getDefaultEMailNotifcationSettings();
        mailSettings.setNotificationDisabled(false);
        mailSettings.setSendOnNewWorkTasks(true);
        designerApp.setDefaultEMailNotifcationSettings(mailSettings);
    }

    /**
     * configure the minimal engine properties so that i can work with 'smtp4dev' or similar
     */
    private static void configureEngineMailProperties() {
        IApplicationConfigurationManager appManager = DiCore.getGlobalInjector()
                .getInstance(IApplicationConfigurationManager.class);
        IProperty host = appManager.getSystemProperty("EMail.Server.Host");
        host.setValue("localhost");
    }
}
link

answered 14.04.2016 at 11:10

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

edited 14.04.2016 at 11:24

Hi Reguel, Thanks for your solution. I tried to configure it in my local but seems I still miss something to make it run. This is what I did: 1. Create a class and copy above code 2. Import JsfWorkflowUi 3. Create a user with email and run the process has a script call to configure of this class.

But I always get exception at this step : IProperty host = appManager.getSystemProperty("EMail.Server.Host"); Can you give me a hint?

Thanks

link

answered 01.11.2016 at 10:48

Tinh%20Nguyen's gravatar image

Tinh Nguyen
(suspended)
accept rate: 0%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×68
×34

Asked: 14.04.2016 at 10:58

Seen: 3,299 times

Last updated: 18.04.2018 at 23:25