Forums

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

Error when executing a Post Function script

francescobabboniidsgeoradar
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!
March 13, 2018

Hi Community.

I would like to execute the following script (FIRE AN EVENT WHEN CONDITION IS TRUE) to send notification e-mail to a defined Project Role, when an issue has been created, with Priority is P1_Blocker and custom field "Product Family / Name" is GPR-HW. The custom field (Id 11778) is a Cascading Select Custom List

customfield11778.jpg

create_issue.JPG

 

 

import org.apache.log4j.Category;
import com.atlassian.jira.ComponentManager;
import com.opensymphony.workflow.InvalidInputException;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.issue.comments.CommentManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.util.ImportUtils;
import com.opensymphony.util.TextUtils
import com.atlassian.jira.component.ComponentAccessor;

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField customField_1 = customFieldManager.getCustomFieldObject("customfield_11778");
String value_1 = issue.getCustomFieldValue(customField_1).toString()

(issue.priority?.name == 'P1_Blocker') && (value_1 == "GPR-HW")

 

It seems that this script doesn't work, because I found these errors inside atlassian-jira.log

2018-03-13 15:40:58,167 http-nio-8080-exec-4 ERROR bafr 940x31876x1 1upedgb 93.33.210.199,10.213.20.15 /secure/QuickCreateIssue.jspa [c.o.jira.customfields.ChecklistReadOnlyCFType] Invalid customfield with ID: null
2018-03-13 15:40:58,167 http-nio-8080-exec-4 ERROR bafr 940x31876x1 1upedgb 93.33.210.199,10.213.20.15 /secure/QuickCreateIssue.jspa [c.o.jira.customfields.ChecklistReadOnlyCFType] Invalid customfield. Could not get value from issue
2018-03-13 15:40:58,212 http-nio-8080-exec-4 ERROR bafr 940x31876x1 1upedgb 93.33.210.199,10.213.20.15 /secure/QuickCreateIssue.jspa [c.o.jira.customfields.ChecklistReadOnlyCFType] Invalid customfield with ID: null
2018-03-13 15:40:58,212 http-nio-8080-exec-4 ERROR bafr 940x31876x1 1upedgb 93.33.210.199,10.213.20.15 /secure/QuickCreateIssue.jspa [c.o.jira.customfields.ChecklistReadOnlyCFType] Invalid customfield. Could not get value from issue
2018-03-13 15:41:09,669 http-nio-8080-exec-12 ERROR bafr 941x31897x1 1upedgb 93.33.210.199,10.213.20.15 /secure/AjaxIssueAction.jspa [c.o.jira.customfields.ChecklistReadOnlyCFType] Invalid customfield with ID: null
2018-03-13 15:41:09,670 http-nio-8080-exec-12 ERROR bafr 941x31897x1 1upedgb 93.33.210.199,10.213.20.15 /secure/AjaxIssueAction.jspa [c.o.jira.customfields.ChecklistReadOnlyCFType] Invalid customfield. Could not get value from issue
2018-03-13 15:41:09,698 http-nio-8080-exec-12 ERROR bafr 941x31897x1 1upedgb 93.33.210.199,10.213.20.15 /secure/AjaxIssueAction.jspa [c.o.jira.customfields.ChecklistReadOnlyCFType] Invalid customfield with ID: null
2018-03-13 15:41:09,698 http-nio-8080-exec-12 ERROR bafr 941x31897x1 1upedgb 93.33.210.199,10.213.20.15 /secure/AjaxIssueAction.jspa [c.o.jira.customfields.ChecklistReadOnlyCFType] Invalid customfield. Could not get value from issue
2018-03-13 15:41:09,729 http-nio-8080-exec-12 ERROR bafr 941x31897x1 1upedgb 93.33.210.199,10.213.20.15 /secure/AjaxIssueAction.jspa [c.o.jira.customfields.ChecklistReadOnlyCFType] Invalid customfield with ID: null
2018-03-13 15:41:09,729 http-nio-8080-exec-12 ERROR bafr 941x31897x1 1upedgb 93.33.210.199,10.213.20.15 /secure/AjaxIssueAction.jspa [c.o.jira.customfields.ChecklistReadOnlyCFType] Invalid customfield. Could not get value from issue
2018-03-13 15:41:09,752 http-nio-8080-exec-12 ERROR bafr 941x31897x1 1upedgb 93.33.210.199,10.213.20.15 /secure/AjaxIssueAction.jspa [c.o.jira.customfields.ChecklistReadOnlyCFType] Invalid customfield with ID: null
2018-03-13 15:41:09,752 http-nio-8080-exec-12 ERROR bafr 941x31897x1 1upedgb 93.33.210.199,10.213.20.15 /secure/AjaxIssueAction.jspa [c.o.jira.customfields.ChecklistReadOnlyCFType] Invalid customfield. Could not get value from issue

 

Can you please help me to understand how to solve this "issue"? :)

Thanks in advance,

Best Regards,

Francesco

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events