- BPM
A complete list of all the BPM methods is available here: Activiti API.
Below you can find some common examples.
Below you can find some example relative to the Activiti process api for all the possible method go to Tasks Api documentation.
TasksApi.listTasks(tasksQuery)
return a list of task based on the tasksQuery
query
import { TasksApi, TaskQueryRepresentation } from '@alfresco/js-api';
const alfrescoApi = new AlfrescoApi(/*...*/);
const taskApi = TasksApi(alfrescoApi);
const tasksQuery = new TaskQueryRepresentation();
taskApi.listTasks(tasksQuery).then(
(data) => {
console.log('listTasks ' + data);
},
(error) => {
console.log('Error' + error);
});
TasksApi.getTask(taskId)
Returns the TaskRepresentation of single task by id
Parameters
Name | Type | Description |
---|---|---|
taskId | String | taskId |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const taskApi = TasksApi(this.alfrescoApi);
const taskId = '10'; // String | taskId
taskApi.getTask(taskId).then(
(data) => {
console.log('Task representation ' + data);
}, (error) => {
console.log('Error' + error);
});
TasksApi.filterTasks(requestTasks)
Returns the ResultListDataRepresentation that is a filtered list of all the tasks.
Parameters
Name | Type | Description |
---|---|---|
requestTasks | TaskFilterRequestRepresentation | requestTasks |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const taskApi = TasksApi(alfrescoApi);
const requestTasks = new TaskFilterRequestRepresentation({
appDefinitionId: 1
});
taskApi.filterTasks(requestTasks).then(
(data) => {
console.log('Task filter list ' + data);
},
(error) => {
console.log('Error' + error);
});
TasksApi.completeTask(taskId)
To complete a task (standalone or without a task form).
Parameters
Name | Type | Description |
---|---|---|
taskId | String | taskId |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const taskApi = TasksApi(alfrescoApi);
const taskId = '10'; // String | taskId
taskApi.taskApi.completeTask(taskId).then(
() => {
console.log('Task completed');
},
(error) => {
console.log('Error' + error);
});
TasksApi.getTaskForm(taskId)
Retrieve the Task Form representation.
Parameters
Name | Type | Description |
---|---|---|
taskId | String | taskId |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const taskApi = TasksApi(this.alfrescoApi);
const taskId = '10';
taskApi.getTaskForm(taskId).then(
(data) => {
console.log('Task form representation' + data);
},
(error) => {
console.log('Error' + error);
});
completeTaskForm(taskId, completeTaskFormRepresentation)
Complete a Task Form
Parameters
Name | Type | Description |
---|---|---|
taskId | String | taskId |
completeTaskFormRepresentation | CompleteFormRepresentation | completeTaskFormRepresentation |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const taskApi = TasksApi(this.alfrescoApi);
const taskId = '10'; // String | taskId
taskApi.completeTaskForm(taskId, completeTaskFormRepresentation).then(
() => {
console.log('Task completed');
},
(error) => {
console.log('Error' + error);
});
ProcessInstancesApi.getProcessInstances(requestNode)
Retrieve a list of process instances, see ResultListDataRepresentationProcessInstanceRepresentation
Parameters
Name | Type | Description |
---|---|---|
requestNode | ProcessInstanceQueryRepresentation | requestNode |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const processApi = ProcessApi(alfrescoApi);
const requestNode = new ProcessInstanceQueryRepresentation();
processApi.getProcessInstances(requestNode).then(
(data) => {
console.log('All processes' + data);
},
(error) => {
console.log('Error' + error);
});
Filtered process:
const alfrescoApi = new AlfrescoApi(/*...*/);
const processApi = ProcessApi(this.alfrescoApi);
const requestNode = new ProcessInstanceQueryRepresentation({
page: 0,
sort: 'created-desc',
state: 'completed'
});
processApi.getProcessInstances(requestNode).then(
(data) => {
console.log('All processes completed' + data);
},
(error) => {
console.log('Error' + error);
});
Below you can find some example relative to the Activiti process api for all the possible method go to Models Api documentation.
getModel(modelId, opts)
To retrieve details about a particular model (process, form, decision rule or app) return a ModelRepresentation
Parameters
Name | Type | Description | Notes |
---|---|---|---|
modelId | Number | modelId | |
includePermissions | Boolean | includePermissions | [optional] |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const modelsApi = new ModelsApi(alfrescoApi);
const opts = {
filter: 'myReusableForms',
modelType: 2
};
modelsApi.getModels(opts).then(
(data) => {
console.log('All your reusable forms' + data);
},
(error) => {
console.log('Error' + error);
});
Below you can find some example relative to the Activiti report api for all the possible method go to Report Api documentation
ReportApi.createDefaultReports()
Creates the default reports
const alfrescoApi = new AlfrescoApi(/*...*/);
const reportApi = ReportApi(alfrescoApi);
reportApi.createDefaultReports();
ReportApi.getReportList()
Retrieve the available report list
const alfrescoApi = new AlfrescoApi(/*...*/);
const reportApi = ReportApi(alfrescoApi);
reportApi.getReportList();
ReportApi.getReportParams(reportId)
Retrieve the parameters referring to the reportId.
Parameters
Name | Type | Description |
---|---|---|
reportId | String | reportId |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const reportApi = ReportApi(alfrescoApi);
const reportId = '1';
reportApi.getReportParams(reportId);
ReportApi.getProcessDefinitions()
Retrieve the process definition list for all the apps.
const alfrescoApi = new AlfrescoApi(/*...*/);
const reportApi = ReportApi(alfrescoApi);
reportApi.getProcessDefinitions();
getTasksByProcessDefinitionId(reportId, processDefinitionId)
Retrieves all tasks that refer to the processDefinitionId
Parameters
Name | Type | Description |
---|---|---|
reportId | String | reportId |
processDefinitionId | String | process definition id |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const reportApi = ReportApi(alfrescoApi);
const reportId = '1';
const processDefinitionId = '1';
reportApi.getTasksByProcessDefinitionId(reportId, processDefinitionId);
ReportApi.getReportsByParams(reportId, paramsQuery)
Generate the reports based on the input parameters
Parameters
Name | Type | Description |
---|---|---|
reportId | String | reportId |
paramsQuery | Object | Query parameters |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const reportApi = ReportApi(alfrescoApi);
const reportId = '1';
const paramsQuery = { status: 'ALL' };
reportApi.getReportsByParams(reportId, paramsQuery);
ReportApi.updateReport(reportId, name)
Update the report details
Parameters
Name | Type | Description |
---|---|---|
reportId | String | reportId |
name | String | The report name |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const reportApi = ReportApi(alfrescoApi);
const reportId = '1';
const name = 'new report name';
reportApi.updateReport(reportId, name);
ReportApi.exportToCsv(reportId, queryParams)
Export a report as csv
Parameters
Name | Type | Description |
---|---|---|
reportId | String | reportId |
queryParams | Object | Query parameters |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const reportApi = ReportApi(alfrescoApi);
const reportId = '1';
const queryParams = {
processDefinitionId: 'TEST:99:999',
dateRange: {
startDate: '2017-01-01T00:00:00.000Z',
endDate: '2017-01-24T23:59:59.999Z',
rangeId: 'currentYear'
},
slowProcessInstanceInteger: 10,
status: 'All',
__reportName: 'FAKE_REPORT_NAME'
};
reportApi.exportToCsv(reportId, queryParams);
ReportApi.saveReport(reportId, queryParams)
Save a report
Parameters
Name | Type | Description |
---|---|---|
reportId | String | reportId |
queryParams | Object | Query parameters |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const reportApi = ReportApi(alfrescoApi);
const reportId = '1';
const queryParams = {
processDefinitionId: 'TEST:99:999',
dateRange: {
startDate: '2017-01-01T00:00:00.000Z',
endDate: '2017-01-24T23:59:59.999Z',
rangeId: 'currentYear'
},
slowProcessInstanceInteger: 10,
status: 'All',
__reportName: 'FAKE_REPORT_NAME'
};
reportApi.saveReport(reportId, queryParams);
ReportApi.deleteReport(reportId)
Delete a report
Parameters
Name | Type | Description |
---|---|---|
reportId | String | reportId |
Example
const alfrescoApi = new AlfrescoApi(/*...*/);
const reportApi = ReportApi(alfrescoApi);
const reportId = '1';
reportApi.deleteReport(reportId);