Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

With the Preview Context and Template rendering features you can validate correct behaviour up front, saving time!

Example templates

Identifying recent attachments to notifications

Adding all attachments from an issue to a template could be problematic if a large quantity of attachments where present on an issue. The following script can be used to identify if attachments where recently added to the issue.

Template

Code Block
$context.issue.key.asText()
$jemhUtils.setCommentRendered()
#set($attachments = $context.issue.fields.attachment)

##If there are attachments present on the issue ...
#if($attachments)
    ##record current time
    #set($timeNow = $jemhDateUtils.nowDate().getTime())
    ##for each attachment....
    #foreach($attachment in $attachments)
        ##retrieve the time the attachment was added to the issue
        #set($created = $attachment.created)
        ##if not null
        #if($created.asText())
            ##gt the difference in time and store as a date object
            #set($difference = $jemhDateUtils.getDate($timeNow - $jemhDateUtils.getDate($created).getTime()))
            ##create a new date 5 minuets ahead of '0'
            #set($targetTime = 	$jemhDateUtils.addMinutes($jemhDateUtils.getDate(0), 5))
            ##check if difference is before five minuets 
            #if($difference.before($targetTime))
                <h3>$attachment.filename.asText()</h3>
                <p>$attachment.content.asText()</p>
            #end
        #end
    #end
#end

How it looks

...

Filter by label (Content by label)
showLabelsfalse
max5
spacesJEMHCshowSpacefalse
sortmodified
typeshowSpacepagefalse
reversetrue
labelstypetemplate webhook velocitypage
cqllabel in ( "velocity" , "template" , "webhook" ) and type = "page" and space = "JEMHC"
labelstemplate webhook velocity
Page Properties
hiddentrue


Related issues

 


...