You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello,
I have the below .groovy script that would create a simple ticket.
Executing the below script on Scriptrunner's Script console creates ticket for "IssueTypeID=10002"(Service Request with Approvals) with Channel set to "Jira" by default as expected.
When trying to execute the below script with a newly created "IssueTypeID=10701"(Approval task), the Channel is set to "Unknown".
Why would the Channel be set to "Unknown" for a brand new Issue type and be set to "Jira" for the existing issue types ?
On the other note, I do know how to set the request.channel.type="Jira" programmatically after creating the issue. But, I don't want to set it unless needed.
Any insight on why Channel would show as "Unknown" for brand new issue type ?
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
long projectId = 10201 //Project Id
//def issueTypeID = "10701" //Approval task (brand new issuetype)
def issueTypeID = "10002" //Service Request with Approvals (existing issuetype)
//def issueTypeID = "10001" // Service Request (existing issuetype)
ApplicationUser currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
IssueService issueService = ComponentAccessor.getComponent(IssueService)
def issueInputParams = ComponentAccessor.getComponent(IssueService).newIssueInputParameters().with {
setProjectId(projectId)
setIssueTypeId(issueTypeID)
setReporterId(currentUser.name)
setSummary("Test Summary")
setPriorityId("3")
setDescription("Test Description")
}
def validationResult = issueService.validateCreate(currentUser, issueInputParams)
assert validationResult.valid : validationResult.errorCollection
def result = issueService.create(currentUser, validationResult)
result.valid ? log.info("Ticket created: " + result.getIssue().getKey()) :log.info(result.errorCollection.errorMessages[0]);
Maybe you have to enter a value for the customer channel source. Please see below the documentation (or search for your JSM version)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.