It's all about the answers!

Ask a question

Send a notification email after a work item is newly created


0
1
Krasimir Malchev (56531) | asked Jul 06 '17, 7:15 a.m.

I want to send an email only when a work item is completely created (i.e. all preconditions and follow-up actions have passed successfully).
Is there a way (for example, to create a new participant) to be sure that I can safely send the email and to be sure that there are no other follow-up actions which may prevent  the work item from being saved?
What is the action id if it exists?

I was thinking of several alternatives:

1) create a participant and check if there is no oldState of the work item. Then create a notification email
     The drawback here is that I think I am not sure that there could be other follow-up actions which happen after mine and prevent the saving of the work item after mine.
2) Create a participant which adds the users to the subscribers list when the work item is newly created.
    The issue here is that I want to send a notification email only during the creation of the work item, but not during each update.
3) Create an asynchronous task, which checks if the work item is created and no emails have been sent.
      The issue here is that I am not sure if an email has already been created.

Thanks!

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | answered Jul 10 '17, 11:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You can create a followup action. It is pretty easy to detect that a work item is new. The extensions Workshop has some code for it already. 

  1. Is doable
  2. Is an ugly duckling solution that requires 1 and drives users nuts being subscribed to crap they don't want.
  3. I don't know how to detect  the newly create item. https://rsjazz.wordpress.com/2015/10/16/due-date-notifier-an-asynchronous-task-example/ is an example for other stuff, it also has the server code for e-maling if you want to use it in 1 or 3.

Krasimir Malchev selected this answer as the correct answer

Comments
Krasimir Malchev commented Jul 28 '17, 8:45 a.m.

In case option number 1 is selected and I create a participant and send an email in case a new work item is created, how can I be sure that I will not send an email and them another participant fails (executed after mine) which can prevent from saving the work item?
In other words, is there any order of advisor and participant execution? Can I be sure that if I send an email in my participant the work item will surely be saved?


Ralph Schoon commented Jul 30 '17, 7:46 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The order is the order the behavior is configured for the operation and role from top to bottom.


Krasimir Malchev commented Jul 31 '17, 2:26 a.m.

 Just for confirmation, the only way to ensure that I send an email to a user right after a work item has just been created is to put my participant in the end of all follow-up actions list?

That is, there is no other mechanism to determine if the work item is saved just like the subscription feature which sends emails as soon as a given action is executed (completed with success).


Ralph Schoon commented Jul 31 '17, 4:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I am sure there are other mechanisms that can be used, but I don't have any particular information about them. I can only answer what I know.
Possible paths to explore would be

+ Asynchronous tasks https://rsjazz.wordpress.com/2015/10/16/due-date-notifier-an-asynchronous-task-example/
+ Events

But I can't provide you details and if these paths can definitely be used.


Krasimir Malchev commented Jul 31 '17, 4:30 a.m.

 Thanks a lot!

For the time being, this solution works for us :-)

One other answer



permanent link
Nate Decker (37814261) | answered Jul 28 '17, 8:52 a.m.
edited Jul 28 '17, 8:54 a.m.

 One option you could consider is looking at the "AdditionalSaveParameter" value of the saveWorkItem3 operation in the follow-up actions. If each follow-up action passes along its own unique id but preserves the ones that it received, then your final follow-up action could review all those save parameters and only send the e-mail if all of the expected parameters are present. If all parameters are present, that would indicate that all follow-up actions have fired.


For this to work, you'd have to have a comprehensive list of all the unique ids being passed along in the AdditionalSaveParameter by each follow-up action.


Comments
Krasimir Malchev commented Jul 30 '17, 7:10 a.m.

 Thank you for your proposal!

Unfortunately I am not able to apply it in my particular case as there are several advisors and participants enabled which are both custom and out of the box. I cannot change the last ones.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.