Manages process instances, process variables, and process audit Log.
string
): Observable
<void>
string
- ID of process to cancelObservable
<void>
- Null response notifying when the operation is completestring
, variables: RestVariable
[]
): Observable
<
ProcessInstanceVariable
[]>
string
- ID of the target processRestVariable
[]
- Variables to updateObservable
<
ProcessInstanceVariable
[]>
- Array of instance variable infostring
, variableName: string
): Observable
<void>
string
- ID of the target processstring
- Name of the variable to deleteObservable
<void>
- Null response notifying when the operation is completestring
): Observable
<any>
string
- ID of the target processObservable
<any>
- JSON datastring
): Observable
<
Blob
>
string
- ID of the target processObservable
<
Blob
>
- Binary PDF datastring
): Observable
<
ProcessInstance
>
string
- ID of the target processObservable
<
ProcessInstance
>
- Metadata for the instancenumber
): Observable
<
ProcessDefinitionRepresentation
[]>
number
- (Optional) ID of a target appObservable
<
ProcessDefinitionRepresentation
[]>
- Array of process definitionsstring
): Observable
<
ProcessInstanceVariable
[]>
string
- ID of the target processObservable
<
ProcessInstanceVariable
[]>
- Array of instance variable infoProcessFilterParamRepresentationModel
, processDefinitionKey?: string
): Observable
<
ProcessListModel
>
ProcessFilterParamRepresentationModel
- Filter for instancesstring
- (Optional) Limits returned instances to a process definitionObservable
<
ProcessListModel
>
- List of process instancesstring
, state?: string
): Observable
<
TaskDetailsModel
[]>
string
- ID of the process instancestring
- (Optional) Task state filter (can be "active" or "completed")Observable
<
TaskDetailsModel
[]>
- Array of task instance detailsProcessFilterParamRepresentationModel
, processDefinitionKey?: string
): Observable
<
ProcessListModel
>
ProcessFilterParamRepresentationModel
- Filter for instancesstring
- (Optional) Limits returned instances to a process definitionObservable
<
ProcessListModel
>
- List of processesstring
): Observable
<any>
string
- Process definition IDObservable
<any>
- Form definitionstring
): Observable
<any>
string
- Process definition IDObservable
<any>
- Form definitionstring
, name: string
, outcome?: string
, startFormValues?: FormValues
, variables?: ProcessInstanceVariable
[]
): Observable
<
ProcessInstance
>
string
- Process definition IDstring
- Process namestring
- (Optional) Process outcomeFormValues
- (Optional) Values for the start formProcessInstanceVariable
[]
- (Optional) Array of process instance variablesObservable
<
ProcessInstance
>
- Details of the process instance just startedany
): any
any
- Object representing form dataany
- JSON dataParameter and return value classes are defined in the Alfresco JS API. See the Activiti REST API pages for further information.
import { ProcessService, ProcessInstance, ProcessInstanceVariable,
ProcessDefinitionRepresentation, ProcessFilterParamRepresentationModel, TaskDetailsModel } from '@alfresco/adf-process-services';
class SomePageComponent implements OnInit {
constructor(private processService: ProcessService) {
}
When starting a process, you can choose to pass in form field values or process variables but not both in the same call.
In this example, values are supplied to the start form that has been defined for the process:
const processDefinitionId = 'InvoiceApprovalProcess:2:21';
const name = 'Sample Invoice Process';
const outcome = null;
const startFormValues = {
approver: '[email protected]',
companyemail: '[email protected]',
invoicetobeapproved: null
};
this.processService.startProcess(processDefinitionId, name, outcome, startFormValues)
.subscribe( (processInstance: ProcessInstance) => {
console.log('ProcessInstance: ', processInstance);
}, error => {
console.log('Error: ', error);
});
A ProcessInstance
object is returned for a successfully started process. This implements the
ProcessInstanceRepresentation interface.
You can start the process with process variables instead of form field values using code like the following:
const processDefinitionId = 'InvoiceApprovalProcess:2:21';
const name = 'Sample Invoice Process (Var)';
const variables: ProcessInstanceVariable[] = [
{name: 'approver', value: '[email protected]'},
{name: 'companyemail', value: '[email protected]'},
{name: 'invoicetobeapproved', value: null},
{name: 'sampleVar', value: 'hello'}
];
this.processService.startProcess(processDefinitionId, name, null, null, variables)
.subscribe( (processInstance: ProcessInstance) => {
console.log('ProcessInstance: ', processInstance);
}, error => {
console.log('Error: ', error);
});
You can also start a process that has no start form and no process variables:
const processDefinitionId = 'SimpleProcess:1:2';
const name = 'Sample Process';
this.processService.startProcess(processDefinitionId, name)
.subscribe( (processInstance: ProcessInstance) => {
console.log('ProcessInstance: ', processInstance);
}, error => {
console.log('Error: ', error);
});
© 2023 Alfresco Software, Inc. All Rights Reserved.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.