Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Channel shows as 'Unknown' when tickets created programmatically for brand new Issue Type

Anita Kalidoss October 7, 2022

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".

Channel_Issue.png

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]);

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 8, 2022

Hi @Anita Kalidoss 

Maybe you have to enter a value for the customer channel source. Please see below the documentation (or search for your JSM version)

https://docs.atlassian.com/jira-servicedesk/3.7.1/com/atlassian/servicedesk/api/request/CustomerRequestChannelSource.html

TAGS
AUG Leaders

Atlassian Community Events