Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a request using servicedeskapi with custom fields?

Bruno Oliveira June 19, 2023

I need to create a request using the servicedeskapi api, the problem is that I can't use the custom fields of the request type.


Through the console I have 2 custom fields (Services and Product/Platform), the problem is that when I use the endpoint to bring the available fields "servicedesk/{serviceDeskId}/requesttype/{requestTypeId}/field", it only returns summary, description and attachment, which are the default fields.


Can anyone tell me if this is possible using servicedeskapi?

image.png

1 answer

1 accepted

0 votes
Answer accepted
Fernando Eugênio da Silva
Community Champion
June 19, 2023

@Bruno Oliveira , Welcome to the Atlassian Community!

 

To create a request by REST API you need to consider the API for Jira Cloud in Jira Service Management here

Also, you need to pass the correct JSON observing the requestFieldValues input format. The doc explain how to do that. If you're not confortable using REST API the safe way is first create an issue with all values you want by jira itself, do a GET by API and collect the correct JSON structure for all field types you want.

 

Hope this helps,

Fernando

Bruno Oliveira June 19, 2023

Hi @Fernando Eugênio da Silva, thanks for the reply.

The method I'm using is the same.
It turns out that I need to create the request with the "Services" and "Product/Plataform" fields filled in. But as I said, through this informed method I can only fill in the standard fields (summary, description and attachment).

I managed to create it manually through the Service Desk console and then do the GET through the API to see how the fields are filled in, but the custom fields do not return in the get request method.

Fernando Eugênio da Silva
Community Champion
June 20, 2023

@Bruno Oliveira 

I realize that your fields are associated with a forms applied to the Request Type.

Are these fields configured in Forms associated with Jira fields or are they just fields created from forms without being linked to Jira fields?

Also, can you share the Payload you are using in the request? So I can test over here and see what's going on

Bruno Oliveira June 20, 2023

@Fernando Eugênio da Silva 

I did a test by creating via console and filling in all the form fields as you can see in the print below.

It turns out that when I get this request, these custom fields do not appear as you can see.

I believe they are fields unrelated to jira forms, because for each chosen category a different form template appears.

image.pngimage.png

Bruno Oliveira June 20, 2023

The Forms appears like this on the request page. It's a custom form.

image.png

Fernando Eugênio da Silva
Community Champion
June 20, 2023

@Bruno Oliveira 

You need to associate these Forms fields with Jira fields. That's because Forms fields work in a different way that somehow doesn't 'consume' Jira's base fields globally.

Go to 'Project Settings' > Forms > Access the form and the field you want, when clicking on the field in Forms you will have the option 'Linked Jira Field', the form field needs to be associated with a Jira field with the same options. Only when you have a Jira field with the values and associated with a form field will you be able to create REST API issues with these custom fields.

 

Here to know How to Link a form field to a Jira field.

There's an Atlassian Ticket opened to expand Forms resource using REST API: JSDCLOUD-10671. But now, to create issues by REST API using Forms, you need to link a jira field into a jira field forms firstly.

 

Any questions, let me know.

Like Bruno Oliveira likes this
Bruno Oliveira June 20, 2023

Thank you for the explanation.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events