Due Date Email Notification Follow
I am working on the following task:
Whenever there is a ticket overdue AND a comment was posted, then sens an email to e.g. Assignee
SUBJ: (project)(ticket-id) OVERDUE since (due-date): (ticket-priority) (ticket-title)
Include a link to the ticket
if :
commented: include last comment
OR if no comments is available, original ticket-body in the ticket"
i have developed it as following:
<code>
action: function(ctx) {
var issue = ctx.issue;
if (issue.fields.DD < Date.now() && issue.comments != null) {
issue.fields.Assignee.notify(issue.id +' OVERDUE since '+ new Date(issue.fields.DD ).toDateString('yyyy MM dd') + ': ' + issue.fields.Priority +', '+ issue.summary , issue.url +' Last Comment:'+ issue.comments.last().text );
} else {
issue.fields.Assignee.notify(issue.id , issue.description );
}
},
</code>
and i added this :
<code>
Priority: {
type: entities.EnumField.fieldType
},
</code>
in requirements as well.
But i receive [object Object] for issue.fields.Priority.
AND when there is no comment on issue, the ELSE statement doesn't work.
could you please tell me what is wrong here?
Please sign in to leave a comment.
issue.comments are always there. In case there're actually no comments on the issue, the Set is empty, but not null.
As for the Priority field question. We'll add a more descriptive toString method to the object, but for now please be aware that there's a name property of the enum field that you actually need.
Thanks for Reply.
My problem with issue.comments is solved.
But the problem with Priority has been not.
The funny thing is, when write it alone in subject area:
issue.fields.Assignee.notify(issue.fields.Priority , issue.url);
it returns the correct value of Priority filed like "Normal 4" , but when i combine it with something else:
issue.fields.Assignee.notify( issue.id + issue.fields.Priority , issue.url);
it returns [object Object] instead of Normal 4
by the way i added the name property of enum filed.
any suggestion?
Thank you,
That's due to incorrect (actually, not implemented) toString function of Priority object. My suggestion was that you write issue.fields.Priority.name instead of just issue.fields.Priority.
Thank you very much.
The problem is solved.
appreciate your help.