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.
@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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.