You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hi Community,
I have this piece of script which is suppose to create a ticket and set value to them.
def issueObject = issueFactory.getIssue()
def cfParticipant = "sd.request.participants.field.name"
issueObject.setProjectObject(project)
issueObject.setSummary(subject)
issueObject.setDescription(MailUtils.getBody(message))
issueObject.setIssueTypeId(project.issueTypes.find {it.name == "Service Request"}.id)
issueObject.setReporter(reportermail)
issueObject.setCustomFieldValue(cfParticipant, "addresses")
messageHandlerContext.createIssue(user, issueObject)
But the problem is that it is not setting value for the custom field : "sd.request.participants.field.name"
Can I get some advice please.
Best regards,
Jason Li
Hi Jason,
Do you recall where you found this snippet? The first argument to setCustomFieldValue needs to be a CustomField object rather than a plain string:
def cfParticipant = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Request participants")
The above assumes that you have ComponentAccessor imported; if not, you can do so at the top of your script as follows:
import com.atlassian.jira.component.ComponentAccessor
Note also that ScriptRunner will issue a deprecation warning against the use of getCustomFieldObjectByName. It is safe to ignore this, although for maximum futureproofing you may prefer to replace that call with the following:
getCustomFieldObjectsByName("Request participants")[0]
Regards,
Joanna Choules, Adaptavist Product Support
Hi Joanna.
Thank you very much for your help. I have been able to sort the problem.
Best regards,
Jason
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.