# Snippets: Service Management

> Oktul Code Studio script snippets for Jira Service Management requests, copied from the console and run by its tests.
>
> Documentation for Oktul Code Studio, for Jira Cloud and Confluence Cloud, by Oktul: https://oktul.com/docs/plugins/code-studio/snippets/service-management/

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](../../writing-scripts/) and the [script API reference](../../script-api/).

## Raise a customer request

Raises a request in a service space through the Service Management API, with the request type's own fields.

```ts
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

- [Writing scripts](../../writing-scripts/)
- [Requests to other systems](../../requests-to-other-systems/)
- [Script examples](../../script-examples/)

---

A problem or a question? Write to [support@oktul.com](mailto:support@oktul.com) or open a request in the [Help Center](https://oktul.atlassian.net/servicedesk/customer/portals). Both reach the same service desk, so either way the request gets a reference and an SLA measuring the response.
