Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Set a Jira custom field with the attribute value from a selected object - Condition

Anna Protopapa November 25, 2020

We use "Set a Jira custom field with the attribute value from a selected object" post function in a workflow. We need to have a condition based of the values of select list field. Ca you give me an example?

Thank you,

Anna

3 answers

0 votes
Siva August 24, 2021

Hi,

How can the attribute name:  both "xyz" and Let us say "ABC" from the Insight object must be in the Approver field of the ticket. ? 

If I do it your way with the post function with one another. It first sets the XYZ as approver and than overwrites the approver with the "ABC" that doesn't fit. 

So, how can i set the attributes XYZ and ABC attributes from the Insight object  in the Approver field ?

0 votes
Peter Pešta June 2, 2021

May I ask, how did it got working?
I´m trying to use the same post-function to copy a object attribute (type select) into a text field and no matter what I try, the target text field has no value.

Thank you and best regards,
Peter Pestainsight_pf.PNG

0 votes
Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 26, 2020

Hi @Anna Protopapa ,

for example this one. It is expected that true or false value is returned to determine, it the post function should be executed or not.

Anna Protopapa December 2, 2020

Thank you for the answer. I am looking for the code of the condition to be based of the values of select list field and not on an insight insight custom field.

Hana Kučerová
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 20, 2020

Hi @Anna Protopapa ,

I assume your field has "Select List (single choice)" type. Then you can use something like this - if in custom field with id 12345 option with value "Your Value" is stored, the post function will be executed:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.fields.CustomField

Long customFieldId = 12345
String customFieldValue = "Your Value"

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
CustomField customField = customFieldManager.getCustomFieldObject(customFieldId)
Option customFieldOption = issue.getCustomFieldValue(customField) as Option
return customFieldOption?.getValue() == customFieldValue

Suggest an answer

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

Atlassian Community Events