How to Set Custom Fields (Incoming Mail Handler)

Batuhan ŞEN August 10, 2022

Hello everyone,

I am trying ScriptRunner Mail Handler to Create Issue With Attachments.

https://scriptrunner.adaptavist.com/5.7.2/jira/mail-handler.html

 

When the project has just summary, description and attachment. It works and issue is created but the project has custom fields on create screens, I am adding this code but it did not work.

How can I handle it or how can I set the custom fields using mail handler?

....

CustomFieldManager bcustomFieldManager = ComponentAccessor.getCustomFieldManager()
CustomField bcf_ComplaintField = bcustomFieldManager.getCustomFieldObject(11111)
CustomField bcf_Comp_InfoField = bcustomFieldManager.getCustomFieldObject(11112)
CustomField bcf_ServiceField = bcustomFieldManager.getCustomFieldObject(11113)

.....

def issueObject = issueFactory.getIssue()
issueObject.setProjectObject(project)
issueObject.setSummary(subject)
issueObject.setCustomFieldValue(bcf_ComplaintField,"A")
issueObject.setCustomFieldValue(bcf_Comp_InfoField,"B")

issueObject.setCustomFieldValue(bcf_ServiceField,"C")

 

 

 After added the custom fields, an error occurred like that; ( It works without custom fields)

Caused by: com.atlassian.jira.workflow.WorkflowException: Error occurred while creating issue. This could be due to a plugin being incompatible with this version of JIRA. 

 

Thank u.

 

 

1 answer

1 accepted

0 votes
Answer accepted
Batuhan ŞEN August 12, 2022

Suggest an answer

Log in or Sign up to answer