ETL to administrate new users and send them an E-mail

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • ETL to administrate new users and send them an E-mail


      I wanted to ask, whether somebody has tried to create an E-mail (with groovy) and send it to specified users out of an ETL-Job?

      I created an ETL project that creates new users with the respective properties and groups.
      See image:
      2019-09-20 12_03_50-jedox_user_administration.png

      I would like also to automate the Mail to those new users with a short description how to access Jedox and change the initial Password. Since the information is already in the source file and respective field transform, I was wandering whether it is possible for a groovy Job to send a mail. Or is it only possible to set up notification mails for the result of an executed job?

      Many thanks in advance for any ideas.

    • This is how we did it:

      Source Code

      1. mailer = API.getMailer();
      2. mailer.setServer();
      3. /* for 2 recipients */
      4. mailer.addRecipient("");
      5. mailer.addRecipient("");
      6. mailer.setSubject("ETL Test Mail");
      7. mailer.setMessage("Hello! here are the files.");
      8. /* with 2 attachements */
      9. mailer.addAttachment("FileToOlap.csv");
      10. mailer.addAttachment("BikerOrderlines.csv");
      11. mailer.send();
      Display All
    • After some further research and a lot of trial and error, I've finally found a solution.
      If anybody has a similar need, it might come in handy.

      Source Code

      1. def maillist = API.initSource("t_ft_NewUser_MailList");
      2. while (row = maillist.nextRow()) {
      3. rowUser = maillist.getColumnValue("user");
      4. rowemail = maillist.getColumnValue("email");
      5. rowname = maillist.getColumnValue("FirstName");
      6. rowpassword = maillist.getColumnValue("password");
      7. rowMailbody = maillist.getColumnValue("Mailbody");
      8. rowfullName = maillist.getColumnValue("fullName");
      9. mailer = API.getMailer();
      10. mailer.setServer();
      11. mailer.addRecipient(rowemail);
      12. mailer.addRecipient ("")
      13. mailer.setSubject("Acccount Data Jedox");
      14. mailer.setMessage(rowMailbody);
      15. try {
      16. mailer.send();
      17."User: "+rowUser+" | E-Mail: "+rowemail+" | Name: "+rowfullName);
      18. mailer.reset();
      19. }
      20. catch(all){
      21. LOG.warn("Email delivery FAILED");
      22. }
      23. int seconds = 1; //wait for mailer to clean up data
      24."Waiting for" +seconds+" seconds to clean up data");
      25. Thread.sleep(seconds*500);
      26. }
      Display All
      In the FieldTransform ("t_ft_NewUser_MailList") is already everything set up that is needed for the mail being send with the groovy job, including the MailBody (via Groovy Function with multiline strings), since I didn't know whether this function would work with HTML formatting.
    • FYI
      since the new version reading and setting a password with ETL or in a Excel-View is not possible anymore

      No Thanks to the jedox-support, I found a working solution.
      There is an alternative to set a password for a user. It can be done in a groovy Job

      Java Source Code

      1. IConnection con = OLAP.getConnection("System");
      2. con.changePassword("${UserName}","${UserPassword}");
      3."Password set for " + "${UserName}");
      In combination with a Loop Job afterwards multiple users can be set.

      The post was edited 1 time, last by Bjoern.: additional solution found ().