Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to have the field name on a custom notification

mgouirand
Contributor
July 26, 2023

Hello all,

 

I need you help to display the name of a custom field in a comment or notification.

Capture d’écran 2023-07-26 105549.png

How can I identify the field name correctly ?

Thanks for your help !

Marine

2 answers

0 votes
Darryl Lee
Community Champion
July 26, 2023

Hi @mgouirand - it would be helpful if you can provide a screenshot of your actual Automation Rule or the comment/notification part of it, so we can see what your "code" looks like. Thanks!

mgouirand
Contributor
July 27, 2023

Hello @Darryl Lee Please find the screenshot of the automation and the existing rule.

Thanks for your help.

Kind regards,

Marine

automation.png

automation rules.png

Darryl Lee
Community Champion
July 27, 2023

Thank you! I would try:

{{fieldChange.fieldName}}

{{fieldChange.field}}

{{fieldChange.name}}

(Weirdly on my test instance, I cannot even get {{fieldChange.toString or fromString}} to show me anything.)

Darryl Lee
Community Champion
July 27, 2023

OK, tested, and it looks like we have a winner:

{{fieldChange.field}}

I hope this works for you! Also, it's important to note this limitation:

When there are multiple fields that have changed, {{fieldChange}} only contains the first changed value. If multiple values are changed, use # to iterate over these. For example, when setting multiple Fix Versions, then you can iterate over these using {{#changelog.fixVersion}}{{toString}}Learn more about using smart values with sections and lists.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/

Alas, #changelog does NOT let you iterate through every field change if you don't know the field name, so this failed. Repeat, this does not work, but it OUGHT TO (IMHO) if Atlassian fixed it:

{{#changelog}}
{{#field}}
Field: {{field}}, "{{fromString}}" to "{{toString}}"
{{/}}
{{/}}

(Yes, this also would mean Atlassian would have to support nested list expansion, which they do not.)

It's SUPER-annoying.

0 votes
Rilwan Ahmed
Community Champion
July 26, 2023

Hi @mgouirand ,

Use smart value "{{issue.Custom fieldname}}". Let me know if this works. 

In the example below, we have a custom field called Team Leader, and the value of the field is currently Alana Grant

{{issue.Team Leader}} returns Alana Grant 
More details about smart values are in 
mgouirand
Contributor
July 26, 2023

Hello Rilwan,

No it doesn't work ... I have no value at all.

Rilwan Ahmed
Community Champion
July 26, 2023

Hi @mgouirand 

"I have no value at all." - Do you mean the field you want is not having any values in it ? 

Please share the screenshot of your automation rule and a sample ticket with the field for further assistance.

mgouirand
Contributor
July 26, 2023

No it means that with "{{issue.Custom fieldname}}", now I have :

Field : , from "test@yahoo.com" to ""

instead of Field : customfield_10398, from "test@yahoo.com" to ""

mgouirand
Contributor
July 26, 2023

By no value I mean that I have now :

Field : , from 'test@yahoo.com" to ""

instead of :

Field : customfield_10398, from "test@yahoo.com" to ""

 

Thanks,

Marine

Rilwan Ahmed
Community Champion
July 27, 2023

Hi @mgouirand ,

I was not able to get any functions to get the custom field name.

As the value for custom field name doe snot change, is it not OK to just add field name in the rule itself ? i.e. Hardcode

Example: Update "Approvers" from {{issue.Approver2}} to {{issue.Approver3}}
Note: Approver, Approver2 and Approver3 are fieldnames

mgouirand
Contributor
July 27, 2023

Hello @Rilwan Ahmed

Thanks for your feedback.

Yes, it can be done, but we have created multiple custom field name.

Does it means that I have to create multiple automation for each case ?

Rilwan Ahmed
Community Champion
July 27, 2023

@mgouirand 

You can make use of If and Then conditions in Automation rule. 

Sample Screenshot:

image.png

Darryl Lee
Community Champion
July 27, 2023

Ugh, that's a lot of work. @mgouirand is monitoring at least 15 fields. :-/

Suggest an answer

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

Atlassian Community Events