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.