Q: how to create issue with custom fields
marcelstoer opened this issue · comments
Marcel Stör commented
Looking at the CreateIssue
interface I don't understand how I would pass custom fields when creating an issue.
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-post shows that we should pass custom fields such as "customfield_10000"
just like regular properties.
Vladislav Tupikin commented
Please check this out how to create issue with custom fileds:
Code snippet:
export const createIssue = async (client: Version3Client) => {
const projects = await client.projects.getAllProjects();
if (projects.length) {
const { key } = projects[0];
const { id } = await client.issues.createIssue({
fields: {
summary: 'My first issue',
issuetype: {
name: 'Task',
},
project: {
key,
},
customfield_10000: 'value',
},
});
return client.issues.getIssue({ issueIdOrKey: id });
}
throw new Error('First create a project');
};
Marcel Stör commented
Thanks.