I am trying to get the custom field value from lookupissues. But not working.Please help/

Pramod_Kumar_Ojha November 26, 2024

 

{{issue.[Custom Field]}}

I am using above code to get the custom field value in automation scheduled mail. But not working.

Using custom field from my project-

{{issue.Expected Customer Delivery/Deal Closure Date(CXL=>Customer Production)}}

got support from this link- https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/

 

Please help to resolve this.

2 answers

1 accepted

1 vote
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 Leaders.
November 26, 2024

Hi @Pramod_Kumar_Ojha 

For a question like this, context is important for the community to help.  Please post the following:

  • what version of Jira are you using: Cloud, Server, or Data Center
  • when using Cloud, what type of project is this (e.g., company-managed, team-managed, etc.)
  • an image of your complete automation rule
  • images of any relevant actions / conditions / branches
  • an image of the audit log details showing the rule execution

Until we see those...

The Jira Cloud version of automation's Lookup Issues action supports all issues fields, but the Data Center one does not: https://jira.atlassian.com/browse/JIRAAUTOSERVER-877

 

If you are using Jira Cloud, I recommend pausing to check the smart value is correct.  Smart values are name, spacing, and case-sensitive.  When an incorrect one is used, that returns null.  To find the correct smart value (or custom field ID) please try this how-to article: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

If you are using Jira Data Center, there are two possible workarounds depending upon your rule structure:

  1. Use the bulk-handling feature of the scheduled trigger or branches with the plural {{issues}} smart value.  This will provide access to custom fields.
  2. Use the Send Web Request action to call the REST API issue search, and then get the fields from the web response smart value

 

Kind regards,
Bill

Pramod_Kumar_Ojha November 27, 2024
  • what version of Jira are you using: Cloud, Server, or Data Center. ----Cloud
  • when using Cloud, what type of project is this (e.g., company-managed, team-managed, etc.) - Company Managed

    Sharing  images for below screens
  • images of any relevant actions / conditions / branches
  • an image of the audit log details showing the rule execution
  • an image of your complete automation rule 

image.png

image.pngimage.png

Pramod_Kumar_Ojha November 27, 2024

And I am getting Success email of issue key with {{key}} from {{#lookupissues}}.

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 Leaders.
November 27, 2024

The rule you are showing is in Jira Data Center, not Cloud.  This is indicated by the icons in the rule editor and that the audit log shows side-by-side with the rule.

 

Please see my first post about the limitations of the Lookup Issues action for the Data Center version and workarounds.

As you are only sending an email with the issues, please try the bulk-handling feature of the Scheduled trigger rather than using the Lookup Issues action.  With that, you may use the plural {{issues}} smart value.

https://confluence.atlassian.com/automation/run-a-rule-against-issues-in-bulk-993924653.html

Pramod_Kumar_Ojha November 28, 2024

Hi @Bill Sheboy 

Thanks for the response. But i have some query in that which i am mentioning below.

I have 3 sections in Automation.

1. "When:Scheduled"

Here I have selected "Process all issues produced by this trigger in bulk" checkbox as per you suggested above. Hope you are talking about that checkbox only?

2. After that i need to add Component. Currently i have "Then:Lookup Issues" where i have JQL query(project="Test Project CM Sandbox" and resolution is EMPTY and "Need By Date(CM=>CXL)" <=7d).

Do i have to add this or anything else? please suggest.

3. And:Send email

where i am using below code and i am getting success email with ticket ID followed by Summary.

----------------------------------------------------------

Below Requests are pending to complete in next 7 Days.
<ul>
{{#lookupIssues}}
<li><a href="{{url}}">{{key}}</a> - {{summary}}</li>{{/}}
</ul>

----------------------------------------------------------

please suggest the code as above for a custom field. That will be helpful.

custom field Name:Customer / Organization

custom field Id: customfield_23401

-----------------------------------------------------------

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 Leaders.
November 28, 2024

For your scenario, the Lookup Issues action is no longer needed and instead the {{issues}} smart value is used.

 

In the linked documentation I provided, it shows an example rule which exactly matches your case:

https://confluence.atlassian.com/automation/run-a-rule-against-issues-in-bulk-993924653.html#Runaruleagainstissuesinbulk-exampleExample:Sendinganemailwithalistofissues

Like Pramod_Kumar_Ojha likes this
Pramod_Kumar_Ojha December 2, 2024

Great. It worked!

Thanks @Bill Sheboy for the support.

One more issue i am  facing in getting the value for user defined field.

assignee, key and summary system field working fine.

But i have one field in my Project. i.e., "Need by Date"

And i need to include the value for this field too in bulk email.

i tried-

{{Need by Date.value}}

{{customfield_20512.value}}

{{issue.Need by Date}}

{{issue.customfield_20512}}

and some other method. But not working.
Please help me on this too.

Thanks!

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 Leaders.
December 2, 2024

Awesome; I am glad to learn that helped!

 

To find the correct smart value / custom field id for the "Need by Date" field, please try using this how-to article with an example issue:

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

The basic idea is to use a browser tab to call the REST API to load the issue fields, and then search on the page to see how it is available to rules.  I suspect only the custom field id will work, so try something like this:

{{#issues}}
* {{key}} -- {{summary}} is assigned to {{assignee.displayName}} and needed by {{customfield_20512}}
{{/}}

 

 

Like Pramod_Kumar_Ojha likes this
Pramod_Kumar_Ojha December 3, 2024

Great!

It worked.

Once again thank you @Bill Sheboy 

Like Bill Sheboy likes this
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 Leaders.
December 3, 2024

I am glad to learn it is all working!  Please consider marking this question as "answered" to help others with a similar need find solutions faster.  Thanks!

Like Pramod_Kumar_Ojha likes this
0 votes
Bruno Brendel Gomes November 26, 2024

Hello, how are you?

did you tried using this smart value? {{issue.customfield_10001}}

switch the 10001 for the actual id of the field Expected Customer Delivery/Deal Closure Date(CXL=>Customer Production

Pramod_Kumar_Ojha November 26, 2024

I have already tried this. Not Working.
And I am getting issue only for user defined field not for System Field.

Suggest an answer

Log in or Sign up to answer