Skip to main content

GetProcessBundleQuery

Overview

Retrieves a complete process definition package with all metadata, dependencies, and related information.

Purpose

Gets a comprehensive "bundle" of process information including BPMN XML, context loaders, trigger configurations, related processes, and recent execution history. Use this for export, documentation, or deep analysis.

Command Type

CB.Administration.Api.Commands.BPM.Process.GetProcessBundleQuery


Request

{
"cmd": "GetProcessBundleQuery",
"data": {
"processDefinitionId": 456,
"includeInstances": true,
"includeRelatedDefinitions": true
}
}

Request Fields (data object)

FieldTypeRequiredDefaultDescription
processDefinitionIdlongYes-ID of process definition to bundle
includeInstancesbooleanNofalseInclude recent process instances (last 10)
includeRelatedDefinitionsbooleanNofalseInclude definitions called by this process

Response

{
"isSuccessful": true,
"statusCode": "00",
"data": {
"processDefinition": {
"id": 456,
"name": "Loan Approval Workflow",
"description": "Multi-stage loan approval with credit checks",
"category": "Lending",
"version": 2,
"isActive": true,
"createdDate": "2026-01-06T10:30:00Z",
"updatedDate": "2026-01-10T15:45:00Z",
"createdBy": "admin@bank.com",
"updatedBy": "manager@bank.com",
"bpmnXml": "<?xml version=\"1.0\"...>",
"metadata": {
"version": "2.0",
"author": "Process Team",
"tags": ["lending", "approval"],
"changelog": "Added automated fraud detection"
}
},
"contextLoader": {
"type": "LoanApplicationContext",
"description": "Loads loan account data into process variables",
"entityType": "LoanAccount",
"requiredFields": ["loanId"],
"availableVariables": [
{
"name": "loanId",
"type": "long",
"description": "Loan account ID",
"required": true,
"example": 12345
},
{
"name": "amount",
"type": "decimal",
"description": "Loan amount",
"required": false,
"example": 50000.00
},
{
"name": "clientId",
"type": "long",
"description": "Client ID",
"required": false,
"example": 789
}
]
},
"triggerConfiguration": {
"events": ["OnLoanCreation"],
"autoStart": true,
"conditions": "loanAmount > 50000",
"description": "Automatically starts when loan account created with amount > 50,000"
},
"schedulingConfiguration": {
"enabled": false,
"cronExpression": null,
"nextRunTime": null
},
"elementSummary": {
"totalElements": 15,
"breakdown": {
"startEvents": 1,
"endEvents": 2,
"userTasks": 5,
"serviceTasks": 3,
"scriptTasks": 2,
"gateways": 2,
"subprocesses": 0,
"callActivities": 1
},
"userTasks": [
{
"id": "Task_ManagerApproval",
"name": "Manager Approval",
"assignee": "${branchManager}",
"candidateGroups": ["managers"]
},
{
"id": "Task_CreditReview",
"name": "Credit Review",
"assignee": null,
"candidateGroups": ["credit_officers"]
}
],
"serviceTasks": [
{
"id": "Task_CreditCheck",
"name": "Automated Credit Check",
"commandName": "PerformCreditCheckCommand",
"parameters": {
"clientId": "${clientId}",
"loanAmount": "${amount}"
}
}
]
},
"recentInstances": [
{
"instanceId": "550e8400-e29b-41d4-a716-446655440001",
"businessKey": "LOAN-12345",
"status": "COMPLETED",
"startTime": "2026-01-10T09:00:00Z",
"endTime": "2026-01-10T12:30:00Z",
"durationMinutes": 210
},
{
"instanceId": "550e8400-e29b-41d4-a716-446655440002",
"businessKey": "LOAN-12346",
"status": "ACTIVE",
"startTime": "2026-01-11T10:00:00Z",
"endTime": null,
"durationMinutes": null,
"currentTask": "Task_ManagerApproval"
}
],
"relatedDefinitions": [
{
"id": 123,
"name": "Credit Check Subprocess",
"relationship": "CallActivity",
"referencedBy": ["CallActivity_CreditCheck"],
"isActive": true
}
],
"statistics": {
"totalInstances": 150,
"activeInstances": 12,
"completedInstances": 135,
"failedInstances": 3,
"averageDurationMinutes": 180,
"successRate": 0.98
}
}
}

Use Cases

1. Process Export/Backup

// Export complete process package
const bundle = await getProcessBundle({
processDefinitionId: 456,
includeInstances: false,
includeRelatedDefinitions: true
});

// Save to file for backup
fs.writeFileSync(
`process_export_${bundle.data.processDefinition.name}_${Date.now()}.json`,
JSON.stringify(bundle.data, null, 2)
);

2. Process Documentation Generation

const bundle = await getProcessBundle({
processDefinitionId: 456,
includeInstances: true,
includeRelatedDefinitions: true
});

const doc = `
# ${bundle.data.processDefinition.name}

## Description
${bundle.data.processDefinition.description}

## Category
${bundle.data.processDefinition.category}

## Trigger Events
${bundle.data.triggerConfiguration.events.join(', ')}

## User Tasks
${bundle.data.elementSummary.userTasks.map(t => `- ${t.name}`).join('\n')}

## Service Tasks
${bundle.data.elementSummary.serviceTasks.map(t => `- ${t.name}: ${t.commandName}`).join('\n')}

## Statistics
- Total Instances: ${bundle.data.statistics.totalInstances}
- Success Rate: ${(bundle.data.statistics.successRate * 100).toFixed(2)}%
- Average Duration: ${bundle.data.statistics.averageDurationMinutes} minutes
`;

fs.writeFileSync('process_documentation.md', doc);

3. Process Migration/Deployment

// Export from source environment
const sourceBundle = await getProcessBundle({
processDefinitionId: 456,
includeRelatedDefinitions: true
});

// Deploy to target environment
// 1. First, deploy related definitions
for (const related of sourceBundle.data.relatedDefinitions) {
// Get related process bundle
const relatedBundle = await getProcessBundle({
processDefinitionId: related.id
});

// Create in target environment
await createProcessDefinition({
name: relatedBundle.data.processDefinition.name,
bpmnXml: relatedBundle.data.processDefinition.bpmnXml,
category: relatedBundle.data.processDefinition.category
});
}

// 2. Then, deploy main process
await createProcessDefinition({
name: sourceBundle.data.processDefinition.name,
bpmnXml: sourceBundle.data.processDefinition.bpmnXml,
category: sourceBundle.data.processDefinition.category,
contextLoaderType: sourceBundle.data.contextLoader.type,
triggerEvents: sourceBundle.data.triggerConfiguration.events
});

4. Process Dependency Analysis

const bundle = await getProcessBundle({
processDefinitionId: 456,
includeRelatedDefinitions: true
});

console.log(`Process: ${bundle.data.processDefinition.name}`);
console.log(`\nDependencies:`);

if (bundle.data.relatedDefinitions.length > 0) {
bundle.data.relatedDefinitions.forEach(related => {
console.log(`- ${related.name} (${related.relationship})`);
});
} else {
console.log('No dependencies');
}

if (bundle.data.contextLoader) {
console.log(`\nContext Loader: ${bundle.data.contextLoader.type}`);
console.log(`Required Variables:`);
bundle.data.contextLoader.availableVariables
.filter(v => v.required)
.forEach(v => console.log(` - ${v.name}: ${v.type}`));
}

5. Process Health Check

const bundle = await getProcessBundle({
processDefinitionId: 456,
includeInstances: true
});

// Check for issues
const issues = [];

if (bundle.data.statistics.successRate < 0.90) {
issues.push(`Low success rate: ${(bundle.data.statistics.successRate * 100).toFixed(2)}%`);
}

if (bundle.data.statistics.averageDurationMinutes > 300) {
issues.push(`Long average duration: ${bundle.data.statistics.averageDurationMinutes} minutes`);
}

if (!bundle.data.processDefinition.isActive && bundle.data.statistics.activeInstances > 0) {
issues.push(`Inactive process has ${bundle.data.statistics.activeInstances} active instances`);
}

if (bundle.data.relatedDefinitions.some(r => !r.isActive)) {
issues.push('Has inactive dependencies');
}

if (issues.length > 0) {
console.warn(`⚠️ Issues found in ${bundle.data.processDefinition.name}:`);
issues.forEach(issue => console.warn(` - ${issue}`));
} else {
console.log(`${bundle.data.processDefinition.name} is healthy`);
}

Best Practices

✅ Do's

  1. Use for Complete Export

    // Export everything
    const bundle = await getProcessBundle({
    processDefinitionId: 456,
    includeInstances: true,
    includeRelatedDefinitions: true
    });
  2. Check Dependencies Before Deletion

    const bundle = await getProcessBundle({
    processDefinitionId: 456,
    includeRelatedDefinitions: true
    });

    if (bundle.data.relatedDefinitions.length > 0) {
    console.warn('Cannot delete: Process has dependencies');
    }
  3. Use for Process Cloning

    const source = await getProcessBundle({ processDefinitionId: 456 });

    const cloned = await createProcessDefinition({
    name: `${source.data.processDefinition.name} (Copy)`,
    bpmnXml: source.data.processDefinition.bpmnXml,
    category: source.data.processDefinition.category
    });

❌ Don'ts

  1. Don't fetch frequently - Heavy query, cache results
  2. Don't fetch for simple process details - Use GetProcessDefinitionByIdQuery instead
  3. Don't ignore related definitions - May cause deployment failures


Last Updated: January 6, 2026