workflow for dummy, my first workflow

I'm trying to understand how this work, I look in all the pages that I found about the javascript workflow but I guess I'm missing something...

at this point I just want to have an email out to the "businessowneremail" (a custom field) to confirm that a issue was created in it behalf, so I created a workflow and added an action module "ticketcreated" but nothing is happening when I create an issue ticket

(I tried using issue.fields.assignee too)

Any direction is appreciated.

The code is:

var entities = require('v1/entities');

exports.rule = entities.Issue.action({
  // TODO: give the rule a human-readable title
  title: 'Ticketcreated',
  // TODO: define the custom command
  command: 'TicketCreated',
  action: function(ctx) {
    var issue = ctx.issue;
    if (issue.becomesReported)
      {
      workflow.message("hi");
        issue.fields.BusinessOwnerEmail.notify(issue.id,issue.description);
      }
    else
      wokflow.message("it was already there");
    // TODO: specify what to do when the command is executed
  },
  requirements: {
    // TODO: add requirements
  }
});

 

Thank you.

6 comments
Comment actions Permalink

I forgot to mention that I have the email notification integration configured. So the "project" is receiving email, is there something else to there to be able to send email out?

0
Comment actions Permalink

I'm getting closer but one thing that I cannot figure out yet is how to send an email notification using a custom field that contains the email address?

This line is throwing error

 

issue.fields.BusinessOwnerEmail.notify(issue.id,issue.description);

0
Comment actions Permalink

I'm almost sure it is because the issue.fields.BusinessOwnerEmail is not an USER object, but what is the way to do then?

0
Comment actions Permalink

Hi Carlos, am I right and you're trying to send an email to an unregistered user, i.e. just to an email address?

In the old workflow API we've had a sendMail() method that allowed this functionality, in the new workflows it's not available yet. It will be available after the upcoming 2017.3 release. Please wait a bit and give it a try afterwards.

Let me know if you have any further questions. Thanks.

0
Comment actions Permalink

Ok, thank you.... I was hoping to be able to continue on this so by the time of the webminar I can have more specific questions.

0
Comment actions Permalink

Carlos, don't worry, the release is planned to happen within less than a week, so you should be able to have time for testing.
Thanks for your questions!

0

Please sign in to leave a comment.