Integrating a Custom HTML Questionnaire with Jira Service Management
By Ryan
A custom HTML questionnaire lets you collect structured answers on your own website or intranet and land every submission in Jira Service Management as a tracked request, with the full responses attached and the required answers enforced by Jira itself. The setup has three parts: the form, a small server-side function that calls the JSM REST API, and a ScriptRunner validator.
What You Gain
- A questionnaire with your own branding, layout, and question logic
- Every submission arrives as a request with a queue, an SLA, and portal visibility for the requester
- The complete set of answers stays on the ticket as an attachment
- Validation lives in the Jira workflow, so API submissions and portal submissions follow the same rules
Before You Start
How ScaleIT handles this: See plans and pricing
- Service desk and request type IDs: send a GET to
/rest/servicedeskapi/servicedesk, then to/rest/servicedeskapi/servicedesk/{serviceDeskId}/requesttype - Field IDs: list the fields on your request type with
/rest/servicedeskapi/servicedesk/{serviceDeskId}/requesttype/{requestTypeId}/field - Credentials: a service account with agent access and an API token stored in a secrets manager or environment variable
- A server-side endpoint: a serverless function or small backend, so the browser never calls Jira directly and the token never reaches the page
- ScriptRunner for Jira Cloud: installed on the site, for Stage 4
Set It Up Step by Step
The work happens in four stages: build the form, create the request, attach the responses, and validate.
Stage 1: Build the questionnaire
- Create an HTML form with one input per question.
- Name each input after the JSM field it maps to, such as
summaryorcustomfield_10050. - Keep questions that have no matching field in the form anyway, since Stage 3 attaches every answer.
- Set the form to post to your server-side endpoint.
- Add a browser-side required check for a smoother experience. Jira enforces the real rule in Stage 4.
Stage 2: Create the request from your server
- In the function, read the submitted values and map them into
requestFieldValues. - Send a POST to
/rest/servicedeskapi/requestwithserviceDeskId,requestTypeId, andrequestFieldValues. - Add
raiseOnBehalfOfwith the requester's account ID so the request appears in their portal list. - Authenticate with basic auth, using the service account email and the API token.
- Save the
issueKeyfrom the response for the next stage.
{
"serviceDeskId": "10",
"requestTypeId": "25",
"requestFieldValues": {
"summary": "New laptop questionnaire: Jordan Lee",
"customfield_10050": "MacBook Pro"
}
}
Stage 3: Attach the full responses
- Render all answers into one file, such as a PDF or a CSV.
- Send it as the multipart field
filein a POST to/rest/servicedeskapi/servicedesk/{serviceDeskId}/attachTemporaryFile, with the headersX-Atlassian-Token: nocheckandX-ExperimentalApi: opt-in. - Copy the temporary attachment ID from the response.
- Send a POST to
/rest/servicedeskapi/request/{issueKey}/attachmentwithtemporaryAttachmentIdsandpublic. - Set
publicto true so the requester sees the file, or false to keep it agent-only. - Add an
additionalCommentif you want a note posted with the file. - Open the request in the customer portal and confirm the attachment downloads.
Stage 4: Validate answers with ScriptRunner
- Open Jira settings → Workflows.
- Find the workflow for your request type, open its Actions menu, and select Edit.
- Select the Create transition.
- Select Validate details → Add validate details rule.
- Choose ScriptRunner Validate details using a Jira Expression, then select Select.
- Enter a Name for the rule.
- In ScriptRunner Script Validate details, enter a Jira expression such as
issue.customfield_10050 != null. - In Message to Show when Validation Fails, enter the message the form should show.
- Save the workflow.
- Submit a test with the answer missing and confirm the API returns the error and no request is created.
Fixing Common Errors
- 400 on create: a field ID is not on the request type. Recheck it with the request type field endpoint.
- Requester cannot see the attachment: the attachment was sent with
publicset to false. - Request missing from the requester's portal list: the call did not include
raiseOnBehalfOf. - Validation message appears in Jira but not on your site: return the API error text from your function to the form.
Who Should Own It
A managed IT partner is the natural owner for this integration, because it spans the service account, the API token, the server-side function, and the Jira workflow. They keep the field mapping current as request types change and rotate the credentials on schedule. If you already work with an IT partner, send them this guide and add the questionnaire to their scope.
ScaleIt builds and runs Jira Service Management integrations as part of managed IT support for startups and SMBs. Book a free call and we will connect your questionnaire to your service desk.
Verified against Jira Service Management Cloud REST API and ScriptRunner for Jira Cloud on 2026-10-16. Vendor docs: https://support.atlassian.com/jira/kb/how-to-add-an-attachment-to-a-jira-service-management-cloud-ticket-using-the-rest-apis/, https://support.atlassian.com/jira/kb/how-to-create-issues-with-assets-custom-field-using-jira-service-management-api, https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/, https://docs.adaptavist.com/sr4jc/current/features/workflow-rules/validate-details.