When working with Jira Service Management (JSM), you might want to ensure that attachments added during a transition screen are visible to customers. Here’s a step-by-step guide to achieve this:
Prerequisites
Ensure you have administrative access to Jira.
Steps
Identify the Transition Screen:
Navigate to the workflow associated with your project.
Identify the transition where you want to add the attachments.
Configure Post-Function to Handle Attachments:
In the workflow transition, add the Comment Issue Post function Comment issue(s)
Use the following Nunjucks script to add the attachments to the issue comments, making them visible to customers:
{% set result = "" %} {% set recentAttachments = [] %} {% for att in issue.fields.attachment %} {% if now | date("diff", att.created, "seconds") <= 30 %} {% set ignored = recentAttachments.push(att) %} {% set value = att | field("filename") %} {% set result = result + "\n" + "!" + value + "!" + "\n" %} {% endif %} {% endfor %} {{ result }}
Ensure Correct Order of Post-Functions:
Place the above post-function after the built-in post-function
Update change history for an issue and store the issue in the database
.
Test the Configuration:
Perform a test transition and add an attachment.
Verify that the attachment appears in the issue comments and is visible to customers on the portal.