Hi all,
I'm building a form through JSM to help people in my company request a purchase order by submitted a ticket to the finance team. In order to process the request, we need a few docs: a statement of work (SOW) and negotiated services memo (NSM).
Is there a way in native JSM to categorize these appropriately? I have an attachment field on the form for each one, but they attach to the ticket all under the "Attachments" field. When we report on later via csv I'd like to be able to export the SOW attachment's URL under an SOW column (and the same for a NSM). For example: via automation we export a list of all PO requests with their fields, and send it via POST to a google sheet, so it can be compared against another sheet.
I know we cannot create custom attachment fields, but wondering how people may have solved for this. It seems you can't rename a file with automation, only reupload it and delete the original.
Hola klevenick2,
You’re right that Jira ultimately stores all of those uploads in the single Attachments collection on the work item. Native JSM doesn’t give you separate Jira attachment fields for “SOW” and “NSM.”
Forms retains which attachment field the user uploaded the file to, and Automation can read those individual form attachment fields by their field keys. Atlassian documents attachment fields as list values and exposes properties such as the attachment ID and name.
So rather than trying to rename files or create separate attachment fields, I’d use the form itself as the categorization layer.
For example, give the two form attachment fields distinct keys, such as: SOW, NSM
Then, from a Forms submitted automation trigger, you can retrieve values such as:
{{forms.last.SOW.name}}
and
{{forms.last.NSM.name}}
The same attachment-field object also exposes the attachment ID, which gives you a reliable way to distinguish files even though Jira displays them all together under Attachments.
For your Google Sheet export, I’d build the POST payload from those form-field values rather than from {{issue.attachment}}, because {{issue.attachment}} only knows that they’re attachments on the work item and loses the semantic distinction you care about.
One thing I would test before building the whole export is exactly what URL representation you need. The form smart values provide the attachment metadata, but if you need a directly usable download URL in the sheet, you may need to construct it from the attachment ID or retrieve the attachment metadata via the JSM API. Atlassian specifically added support for the Forms API to retrieve form attachment metadata, so the mapping itself is natively supported.
So I’d keep your two upload fields exactly as they are and treat their form keys as your SOW/NSM classification. That avoids file renaming entirely and preserves the distinction you need for Automation and reporting, even though the agent view still shows everything together under Attachments.
Thanks,
James
Hello @klevenick2 ,
@James Gamble has the right layer (the form field key is your category; the work item's Attachments collection has no idea which field a file came from), so let me add the two conditions that make it work end to end, because the second one is where this usually breaks.
1. The smart values exist only on one trigger. {{forms.last.SOW.name}} and {{forms.last.SOW.id}} are populated only when the rule's trigger is Form submitted for that form; on any other trigger (work item created, transitioned, scheduled) they return empty, by design, per Atlassian's forms smart values doc: https://support.atlassian.com/jira-service-management-cloud/docs/access-smart-values-for-forms-and-form-fields/. Field keys are case-sensitive and set on each field in the form builder. If you ever need the same data later in the lifecycle, the route is the Forms REST API from a Send web request action, which Atlassian documents here: https://support.atlassian.com/jira/kb/access-forms-data-with-the-forms-api-in-jira-cloud/.
2. Turn the category into a field the export can read. Your CSV export and the Google Sheet integration read work item fields, not form fields, so the rule's job is to copy each attachment's identity into a field of its own:
SOW document to {{#forms.last.SOW}}{{name}} | https://YOURSITE.atlassian.net/rest/api/3/attachment/content/{{id}}{{/}} and NSM document to the same shape with NSM.{{#forms.last.SOW}}...{{/}} also handles someone uploading two files into one field: you get both, separated as you choose.Now the export has "SOW document" and "NSM document" columns carrying the file name and a direct content URL, and the Attachments collection can stay exactly as it is. The /rest/api/3/attachment/content/{id} URL is the documented download endpoint; whoever opens it needs permission on the work item, which is normally what you want for a purchase order.
One check before you rely on it: add a temporary Log action with {{#forms.last.SOW}}{{name}} ({{id}}){{/}} on the first run to confirm the field key resolves; an empty log line almost always means the key differs from the label or the trigger is not Form submitted.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.