Invalid license: Your Refined is only licensed for 10 users.

Problem: You want to create a customer-facing notification when a new Request participant is added to his/her request

Solution: Create a new notification configuration like the following:


In the example above, we're listening to "Issue updated" event fired by ANY issue type in project MJSM. Moreover, we've specified that we're only interested in changes to "Request participants" custom field.


Now comes the harder part - we need to make sure, that our notification will fire ONLY when a new request participant is being added. Right now it would fire every time there's a change to Request participants custom field and as you understand this is now the desired behaviour. We'll implement the magic needed in Message template section.


First, you need to figure out what's the name of the custom field that stores Request participants in your Atlassian instance. Just click on "Issue field picker" button, choose "Request participants"→Name. You'll be presented with something like the following:

#foreach ($u in $!issue.fields.customfield_10103)
  $!u.displayName
#end


From the code above, we see that request participants are stored in customfield_10103.


To check if the request participant was actually added, we'll use $issue.lastchange property like this:


#set($isNewParticipant = false)
#foreach ($item in $!issue.lastchange.items)
  #if ($item.fieldId == "customfield_10103" and $item.from == "" and $item.to != "")
    #set($isNewParticipant = true)
  #end
#end


On the line 2 we're iterating through all fields changes made during the last issue update and on line 3 we're checking if there was an update to field "customfield_10103" such, that original value was empty and the new value was assigned. If so, it means that a new request participant was added.


The rest of the story is simple, just take the content from the reference template Request participant added - template.html and add it as shown on lines 8-10:


#set($isNewParticipant = false)
#foreach ($item in $!issue.lastchange.items)
  #if ($item.fieldId == "customfield_10103" and $item.from == "" and $item.to != "")
    #set($isNewParticipant = true)
  #end
#end

#if ($isNewParticipant)
  Paste "Request participant added - template.html" content here...
#end