Snippets: Service Management
Oktul Code Studio script snippets for Jira Service Management requests, copied from the console and run by its tests.
These are the snippets the console’s Snippets dialog offers under Service Management. Each is TypeScript; in a .js script the console shows the same code with its types removed. Every one runs unchanged in Code Studio’s own tests. How the API they call behaves is in writing scripts and the script API reference.
Raise a customer request
Raises a request in a service space through the Service Management API, with the request type’s own fields.
export default async function (event: unknown, context: ScriptContext) { const vars = context.environment.vars; const request = await jira.post<{ issueKey: string }>('/rest/servicedeskapi/request', { serviceDeskId: vars.SERVICE_DESK_ID ?? '1', requestTypeId: vars.REQUEST_TYPE_ID ?? '10', requestFieldValues: { summary: 'New laptop for a starter', description: 'Raised by Code Studio.', }, }); return { key: request.issueKey };}Related
A problem or a question? Write to support@oktul.com or open a request in the Help Center (opens in a new tab).