Forums

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

How to add fields to comment in automation

roland.amann
April 28, 2021

Hi,

I am trying to add the value of a field to a comment when creating a new request. I just started fresh with a Service Management Project Template "HR Service Management". I am the only user right now and I have full administrative priviledges accordingly.

I created a new rule in automation which adds the comment to the issue without a problem.

Then I want in that comment the Value from the field "Start date". For that i used the help entry inside automation "How to access issue data in my comments".

I tried the following:

1 {{issue.fields.start date}} 2 {{issue.start date}} 3 {{issue.fields.start date.value}} 4 {{issue.start date.value}} 5 {{issue.fields."start date"}} 6 {{issue.customfield_10015}}

It is always empty. I tried the customfield because I found it when I read the field names by accessing https://<instancename>/rest/api/2/issue/<issuename>?expand=names

 

"Start date" is delivered with the HR Service Management Template. I did not create it myself. It's a default field. Why can't I access it? I also tried copying the field in the field due date. I can even select "Start date" from the drop down list to copy. But this doesnt't work either. Here I get the error message in the audit protocol:

More than one field with same name and type found: Start date (com.atlassian.jira.plugin.system.customfieldtypes:datepicker)

 

I don't understand what I am doing wrong and I couldn't find a proper documentation about how to access the fields and where I get the exact names I have to use.

 

Regards

Roland Amann

3 answers

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 28, 2021

Hi @roland.amann 

Smart value names are case-sensitive, so this one could be: {{issue.Start Date}}

When you want to learn the name of a specific smart value, you can try this method to compare the values in an issue which uses the fields:

https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/

Best regards,

Bill

0 votes
roland.amann
April 28, 2021

Hi @[deleted]

Thank you. I looked in the names again. But this time I did not look for the name of the variable, but searched for the expected value. This worked.

The correct field name in my case is {{issue.customfield_10054}}. Why this is a custom field in the default form and why I can select it in a dropdown box and it still doesn't is beyond me.

But this is a solution I can live with. Thanks.


Regards

Roland

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 29, 2021

Roland, I am glad to hear that worked for you. 

Between the UI/UX, REST API, and smart values, I often check the names with the technique I sent you when something doesn't seem to work as often it is a name mismatch.

Best regards,

Bill

Joshua Keele
January 17, 2022

This does not work for me, can you share your exact syntax as it appears in your comment please?

roland.amann
January 18, 2022

I put this in the field:

 

@Safety Roland Amann: Sicherheitsausrüstung benötigt ab {{issue.customfield_10054}}

0 votes
Callum Carlile _Automation Consultants_
Community Champion
April 28, 2021

Hi @roland.amann I have just tried this out with {{issue.start date}} and it worked fine for me.

Please may you provide a screenshot of your automation rule, just to double check its configuration

roland.amann
April 28, 2021

I made a manual trigger with action "add value to audit-protocol" (translated from german. I don't know if it's called exactly like that in english) and tried it. Did not work.

 

1 {{issue.fields.start date}} 2 {{issue.start date}} 3 {{issue.fields.start date.value}} 4 {{issue.start date.value}} 5 {{issue.fields."start date"}} 6 {{issue.customfield_10015}} 7 {{issue.startdate}}

 

Details zur Aktion:

Protocol 1 2 3 4 5 6 7

Zugehörige Elemente:

Manueller Trigger

HP-12

 

 

28-04-2021 11-24-10.png

 

The comment is created in the task. But the date is empty.

 

28-04-2021 11-28-57.png

 

Edit: Just to make sure. I want the value of the following field. This is the default jira hr Employee onboarding request type form:

28-04-2021 11-48-54.png

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events