Iterate over form values on submit and list the non-empty ones in the Description field

Michael Woffenden
Contributor
December 13, 2024

We're working on creating a JSM automation upon form submittal.

The need is to edit the description field with all the labels and values that the user entered in the last form submitted.

For example, let's say the form asks these questions.

2024-12-13_08-48-03.png

Upon submittal of the form, we want to use automation to edit the Description of the issue as follows:

2024-12-13_08-56-43.png

Note that "Date Needed: was empty, so we don't want to see it in the Description field.

We'd like to accomplish this using smart values but in the most compact fashion.  Also, we have multiple forms (associated with multiple request types) so a generic solution would be best.

Any ideas on how we can accomplish this?

1 answer

0 votes
Jovin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 18, 2024

Hey @Michael Woffenden 

This sounds like an interesting challenge, hopefully the below can help.


Setup of the Forms

  • Ensure every form uses the same custom fields for the selections, or, at least ensure all issue types have those fields available on their view/edit screens

Automation Rule

  1. Trigger: Forms Submitted
    • Forms: Any form (or you can specify which ones)
  2. Condition: IF or ELSE
    • Condition: Issue fields condition
      • Field: <Your first field>
      • Condition: You'll need to change this depending on the field being checked, essentially you want to make sure it is not empty, which for some fields is always implied
    • Action: Edit Issue
      • Field: Description
      • Value:
        {{issue.description}}
        * <Field Name>: {{issue.Field Name}}

You'll then repeat part 2 over and over for each field. This is the "cleanest" and "most readable" way to implement this automation rule, although it uses more actions than others.

Quick note on using the IF/ELSE - you do not want to add an "ELSE" clause as it will only look at one of them, instead only use the "IF" for each of the "IF/ELSE" so it goes over all, skipping those that shouldn't be added (e.g. if empty). See screenshot below as an example:

Update Description Automation.png

Michael Woffenden
Contributor
December 20, 2024

Thanks for the reply, however, we want to iterate over all the existing fields in a "for each" fashion so that we don't have to hardcode field names at all. 

We have different forms with many different fields, therefore hard coding is a chore.

Lists looks promising but we can't find a good example.

Héctor
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 24, 2025

@Hi @Michael Woffenden did you found a solution?

So far I only end up implementing a static value reading per field within the form, but not a dynamic/iterative one.

Héctor
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 24, 2025

@Michael Woffenden so far there are two options:

- Get form from the API and iterate responses https://community.atlassian.com/t5/Jira-articles/Automatically-update-Form-fields-answers-and-manipulate-more/ba-p/2481946

- Use smart values (not really dynamic, but better than before) https://support.atlassian.com/jira-service-management-cloud/docs/access-smart-values-for-forms-and-form-fields/

Will share an example once I test it

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events