Get all Request Type Value (Script Runner)

Bruno Mesquita dos Santos
Contributor
April 10, 2022

Hello everyone,

How can I get all requesty type value from a specify project?

I want to change the request type of an issue already created e also want to create a new issue and pass the request type.

 

Can help me, please?

 

Thanks!

2 answers

1 accepted

2 votes
Answer accepted
Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2022

May I ask what hosting are you using? Cloud or server? You will need to call the endpoint for get all request types then search for the request type you want in the list and determine what further steps you want to take.

Bruno Mesquita dos Santos
Contributor
April 11, 2022

Hi @Prince Nyeche ,

The host is cloud. Right, how can I do it? Can you help me, please? 

Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2022

First of all, do you know how to code in groovy? If you don't then it would be difficult to explain the concept. However, what you should do is look for similar examples here https://library.adaptavist.com/ 

If you do then, the endpoint you should focus on is the get all request type.Please note that the API is experimental, so using the experimental headers is required. 

Bruno Mesquita dos Santos
Contributor
April 11, 2022

No, I don't, but I know to code in Java. I noticed that somethings are equal. 

I got it, all request type.

Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 12, 2022

That's even better because they are particularly similar in most aspect. Were you able to get this issue resolved with those information @Bruno Mesquita dos Santos?

Bruno Mesquita dos Santos
Contributor
April 12, 2022

Ah, perfect.

No, I got all information about the request type but the endpoint did not give me the value of each request type. 

I google and I saw that to change a issue already created or to create a issue and pass the request type is necessary pass the value of the request type, is that right? 

Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 12, 2022

That should be referring to the serviceDeskId. That information is contained there in the request payload. So you have to use a combination of identifying the request type by name, then use the serviceDeskId to perform the change. It's the same way automation for Jira does it.

Bruno Mesquita dos Santos
Contributor
April 13, 2022
When I try to create an issue pass the request type I recived this error:
CreateIssue.PNG
customfield_10601 -> Custom Field of Request Type
1 -> serviceDeskID
Outros -> Request Type Name
Do you know what could be?
Bruno Mesquita dos Santos
Contributor
April 14, 2022

@Prince Nyeche ,

Thanks a lot for the help. I got.

I used the:

(answer) https://MY-HOST/rest/servicedesk/1/servicedesk/request/<IssueID>/request-types

And I got the key.

 

When I used the POST method:

 

        customfield_0000" : <ProjectKey>/<answer>
customfield_0000- customfield do request type
0 votes
David Harkins
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 11, 2024

Is it possible to get a collection of the Customer Request Types of a Project?
From withing a Groovy Script Runner Script and without a web API request.

Suggest an answer

Log in or Sign up to answer