Skip to main content

createJob

codebolt.job.createJob(groupId: string, data: CreateJobData): Promise<JobCreateResponse>

Creates a new job in a specified job group. Jobs represent units of work like tasks, bugs, or features that need to be tracked and managed.

Parameters

  • groupId (string): The ID of the job group to create the job in.
  • data (CreateJobData): The job data including name, type, priority, and optional fields.

Returns

  • Promise<[JobCreateResponse](/docs/reference/type-reference/codeboltjs/interfaces/JobCreateResponse)>: A promise that resolves with the created job.

CreateJobData Properties

PropertyTypeRequiredDescription
namestringYesThe job title/name
typeJobTypeYesType: 'bug', 'feature', 'task', 'epic', 'chore'
priorityJobPriorityYesPriority: 1-4 (4 is urgent)
descriptionstringNoDetailed description
statusJobStatusNoStatus: 'open', 'working', 'hold', 'closed'
assigneesstring[]NoList of assignee IDs
labelsstring[]NoTags/labels for the job
dependenciesJobDependency[]NoDependencies on other jobs
parentJobIdstringNoParent job ID for sub-jobs
notesstringNoAdditional notes
dueDatestringNoDue date in ISO format

Examples

// Basic job creation
const result = await codebolt.job.createJob('group-123', {
name: 'Implement user authentication',
type: 'feature',
priority: 3
});
console.log('Created job:', result.job.id);

// Full job with all options
const fullJob = await codebolt.job.createJob('group-123', {
name: 'Fix login bug',
type: 'bug',
priority: 4,
description: 'Users cannot log in with special characters in password',
status: 'open',
assignees: ['agent-1', 'agent-2'],
labels: ['security', 'urgent'],
notes: 'Reported by multiple users',
dueDate: '2024-02-15T00:00:00Z'
});

Common Use Cases

  1. Feature Development: Create jobs for new features with detailed descriptions
  2. Bug Tracking: Track bugs with priority and assignees
  3. Epic Planning: Create epic-type jobs as containers for related work
  4. Task Management: Break down work into manageable task jobs