Hi Community,
I am using the 'Set the value of an object attribute with a predefined value' Insight Post Function to set an Insight Object Attribute based on the value of a single line text custom field.
The Post Function works fine but now I want to add a condition as I have several of these post function and only one should fire depending on the value of another custom field (select list).
It appears that the problem is to do with the custom field being a select list as I changed it to another field (text) and it worked. Should I be retrieving the value differently for a select list? I added logging and ran this as a custom script post funtion and it returned the correct value so scratching my head now!
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
def cfAttribute = ComponentAccessor.customFieldManager.getCustomFieldObject(11902) // 'Attribute selector' Custom Field ID
def cfAttributeValue = issue.getCustomFieldValue(cfAttribute)
//if 'Attribute selector' value is as required then evaluate to true
if (cfAttributeValue == "Required Value" ) {
return true;
}
return false;