Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

getCustomFieldValue return null in validator, but runs correctly in console


Dear community,

I'm trying to run a Scriptrunner validator's custom script in a certain step (where I review a custom field in all linked issues). The issue is, when I run the below script in console, it works fine and as expected. But when it is triggered in a validator trigger, it "issue.getCustomFieldValue()" always returns null.


The code is as follows (in validator):

def customFieldManager = ComponentAccessor.getCustomFieldManager();
def issueManager = ComponentAccessor.getIssueManager();
def rootCauseCat1 = customFieldManager.getCustomFieldObject("customfield_10422");

 allOutIssueLink = ComponentAccessor.getIssueLinkManager().getInwardLinks(issue.getId());
for (Iterator<IssueLink> outIterator = allOutIssueLink.iterator(); outIterator.hasNext();) {
    IssueLink issueLink = (IssueLink);
    def linkedIssue = issueLink.getDestinationObject();
    String issueKey = linkedIssue.getKey();
    def convIssue = issueManager.getIssueObject(issueKey);

/*Note: Error happens here. When excuted in validator event, getCustomFieldValue returns 'null', but return actual value executed through console*/
    String cRootCauseCat1Value = convIssue.getCustomFieldValue(rootCauseCat1);

    if(cRootCauseCat1Value == "Testing"){
        throw new InvalidInputException("Alert Message Text");

I have called "getCustomFieldValue()" from both issue objects "linkedIssue" and "convIssue". But the same results...

First of all, is the validator the best approach? If not, then please guide... If it is, would appreciate your guidance and support on the script used...

Wish you all the Best of Lucks and Regards ... Yours,



0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

Apps for Confluence you won't want to miss: RSVP for September's Appy Hours

Calling all collaborators and Confluence users! Our Appy Hours event on September 29th features 4 presenters demoing functionality to superpower Confluence. Don't miss learning about these apps i...

117 views 0 9
Read article

Atlassian Community Events