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

Seeking assistance with post-function condition

Durell Demartini May 20, 2024

Hello, I've been reviewing documentation on post-functions for Assets custom fields and I'm using the "Set a Jira custom field with the attribute value from a selected object" post-function to set a value of an attribute from an object to a text field. This is working as expected, but I'm adding the post-function to a common workflow used for many request types, so I'd like to add a condition to have it be triggered only for one specific request type.

When the condition field is blank, the post-function is successful. But when I use the code below, it doesn't work. I'm trying to cobble together some examples that I have seen online and in our environment, but this is not my area of expertise, so I would greatly appreciate any suggestions that you can offer for this script.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
def requestTypeCF = customFieldManager.getCustomFieldObject(Request Type 15293) //Request Type
def requestTypeCFVal = issue.getCustomFieldValue(requestTypeCF)

//if 'requestTypeCFVal' value is as required then evaluate to true
if (requestTypeCFVal == "Onboarding Service Request" ) {
return true;
}
return false;

Thanks in advance for any assistance you can offer.

1 answer

0 votes
Stephen_Lugton
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.
May 20, 2024

@Durell Demartini, a workaround to that would be to add a second connection to your workflow between the statuses you're transitioning from and to, you could then set a value condition on one of Issue Type = "Onboarding Service Request" with your post-function, and have a value condition on the other of Issue Type != "Onboarding Service Request" for all other issue types without the post-function

Durell Demartini May 21, 2024

Hi @Stephen_Lugton thanks for the quick reply and suggestion. I was hoping to use the Assets post-function's condition area as it was meant to be used, but If I can't find a way to make it work, I will definitely keep this workaround in mind. Thanks again. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events