Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

getIssueContext() throws error message as Cannot get property 'pid' on null object

R_Logesh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 30, 2020

Sample Code:

import com.atlassian.jira.component.ComponentAccessor;
import com.onresolve.jira.groovy.user.FieldBehaviours;
import com.atlassian.jira.issue.customfields.option.*;
import com.atlassian.jira.issue.fields.rest.FieldTypeInfoContextImpl
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours

def customFieldManager = ComponentAccessor.getCustomFieldManager();
def customfield = customFieldManager.getCustomFieldObject("customfield_10300");
def customfield_config = customfield.getRelevantConfig(getIssueContext());

return customfield_config

 

Note 1: 

When we execute the above sample code it throws the following error message. So could you please share us the inputs to resolve this error.

Error Message:

Cannot get property 'pid' on null object

java.lang.NullPointerException: Cannot get property 'pid' on null object

                at com.onresolve.jira.groovy.user.FormField.getFormValue(FormField.groovy:187)

                at com.onresolve.jira.groovy.user.FieldBehaviours.getIssueContext(FieldBehaviours.groovy:218)

                at Script1064.run(Script1064.groovy:11)

 

Note 2:  To analysis the root cause , i try to execute the command ctrl+J mouse over the method name getIssueContext().

It tries to launch the page

https://docs.oracle.com/javase/8/docs/api/com/onresolve/jira/groovy/user/FieldBehaviours.html

instead of the below expected one.

https://docs.atlassian.com/software/jira/docs/api/7.11.0/com/atlassian/jira/issue/fields/rest/FieldTypeInfoContextImpl.html

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events