Files
alfresco-ng2-components/docs/process.service.md
T
Eugenio Romano 43032c7fd7 2.1.0 (#2891)
* adf-insights 2.0.1

* update script

* [ADF-2048] Fixed corrupted link in User Guide (#2757)

* [ADF-1752] disable completely sidebar when allowSidebar option is false (#2753)

* [ADF-1752] disable completely sidebar when allowSidebar option is false

* [ADF-1752] improved condition for showing toolbar

* support for explicit viewer type for URL (#2688)

* Fix line clamp temporary (#2747)

* Adding automation-id to search-control component (#2759)

* [ADF-2025] Task List - The pagination should be fetched from the UserPreference (#2733)

[ADF-2025] Task List - The pagination should be fetched from the UserPreference

* Update viewer documentation (#2763)

* [ADF-1431] Destination Picker: Display path of the folder in search results (#2762)

* Add initial implementation with style fixes

* Further style fixes

* Add tests, styling fixes

* Fix the title of Model column in ECM License datatable. (#2770)

* [ADF-1826] Task Header - The priority property should be editable (#2768)

* [ADF-1826] Task Header - The priority property should be editable

* [ADF-1826] - Fixed isEditble typo

* [ADF-1826] - Adding unit test - checking the priority value is displayed

* [ADF-1826] fixed unit test

* [ADF-1826] fixed unit test (replaced fit with it)

* [ADF-2056] update dependencies (#2764)

* update dependencies
add ban for fdescribe in tslint
reenable test
add badge codacy
check bundles esm5 and esm2015
travis run new vuild script

* remove fdescribe

* material 5.0.0 stable release

* comment out test service under should return the task details

* [ADF-2051] Involve people name is not displayed properly. (#2773)

This issue is now fixed

* [ADF-2061] Fix content node selector search (#2772)

* Fix content node selector search

* Fix tests

* [ADF-2069] Error is displayed on console when adding a description to a task. (#2779)

* Fixed the console error coming while adding description or priority in task details

* special CSS class if pagination is empty (#2780)

* add missing exports (#2782)

* [ADF-2065] Refactored Content node selector component  (#2778)

* [ADF-2065] created dialog component for content node selector

* [ADF-2065] removing SiteModel from site dropdown to use SitePaging model of js-api

* [ADF-2065] - removed site model and updated documentation

* [ADF-2065] fixed test for site component

* [ADF-2065] refactored content node selector and created content node selector dialog

* [ADF-2065] fixed test on site-api service

* [ADF-2065] added a new content node dialog service to centralise the logic for content node dialog

* [ADF-2065] start adding test for node-actions service|

* [ADF-2065] added test for node-actions service

* [ADF-2065] added test for node action service

* [ADF-2065] renamed components to keep backward compatibility

* [ADF-2065] added input just for backward compatibility

* [ADF-2065] added some changes for backward compatibility and updated documentation

* [ADF-2065] updated documentation for content node selector

* add missing exports (#2784)

* [ADF-2102] Task List - Provide a way to support custom html template and static columns at same time (#2787)

* * Removed unused adf-task-list keys from app.config
* Fix can add/remove the static property through the app.config and can put custom columns into the html in adf-tasklist component

* Fix add/remove the static property through the app.config and can put custom columns into the html in adf-tasklist component

* * Fixed support custom html template and static columns.
* Updated tasklist doc.
* Fixed failing test case.

* * Fixed support custom html template and static columns

* * Updated task-list documentation.

* [ADF-2094] Task Form - Doesn't follow the specification (#2786)

* [ADF-2094] Task Form - Doesn't follow the specification

* Removed icon visible beside title

* Made font-size for title as semibold 20px

* Set the outcome buttons on bottom right side

* set color of Complete button as primary

* [ADF-2094] Task Form - Doesn't follow the specification
* Changed the css for the Adf-form according to zeplin design

* Removed icon visible beside title

* Made font-size for title as semibold 20px

* Set the outcome buttons on bottom right side

* set color of Complete button as primary

* [ADF-2094] Task Form - Doesn't follow the specification

* Changed the css for the adf-form according to zeplin design

* Removed icon visible beside title

* Made font-size for title as semibold 20px

* Set the outcome buttons on bottom right side

* set color of Complete button as primary

* [ADF-2103] Info Drawer - Provide a way to select a different tab (#2788)

* Provide a way to select a different tab

* Fix the default value

* Override the value through the html

* fix different material depencncies (#2791)

* [ADF-2070][ADF-2071][ADF-2072] 'Load more' on destination picker does… (#2774)

* [ADF-2070][ADF-2071][ADF-2072] 'Load more' on destination picker doesn't display correct content of folders

* [ADF-2070][ADF-2071][ADF-2072] add tests

* [ADF-2070][ADF-2071][ADF-2072] 'Load more' on destination picker doesn't display correct content of folders

* [ADF-2102] Task List - Provide a way to support custom html template and static columns at same time (#2793)

* Removed lodash import from tasklist component.
* Refactored getschema method.

* [ADF-2067] Not able to see the 'My tasks' filter when clicking on a newly created app. (#2792)

* fixed Not able to see the 'My tasks' filter when clicking on a newly created app.
* Create default services return response with id.

* [ADF-2098] Start Process - the default process definition should be selected  (#2794)

* [ADF-2098] Start Process - the default process definition should be selected

* made the start-process component to automatically select Process definition if it is the only definition.

* [ADF-2098] Start Process - the default process definition should be selected

* made the start-process component to automatically select a processDef in start-form if there just one processDef present

* [ADF-2098] Start Process - the default process definition should be selected

* made the start-process component to automatically select a processDef in start-form if there just one processDef present

* Update start-process.component.html

* Update start-process.component.ts

* Fix adf is not defined for customStencil (#2795)

* [ADF-2109] Task Form - The form doesn't fit in the mobile screen (#2797)

* [ADF-2109] Task Form - The form doesn't fit in the mobile screen

* Made form mobile compatible

* Fixed issues arising due to the issue ADF-2094

* [ADF-2109] Task Form - The form doesn't fit in the mobile screen

* Made adf form mobile compatible

* Fixed issues arising due to the issue ADF-2094

* [ADF-2095] Start Task - The start button should have the primary colour (#2799)

* [ADF-2095] Start Task - The start button should have the primary colour.

* fixed start button should have the primary colour.

* [ADF-2095] Start Task/Process - The start button should have the primary colour.

*  fixed start button should have the primary colour and Uppercase.

* * Start task button should have the primary colour

* [ADF-1958] Process Attachment list - The empty list should be a simpl… (#2798)

* [ADF-1958] Process Attachment list - The empty list should be a simple template

* changed the default empty list to a simple template

* changed process-attachment.component.html so that the user can pass custom empty tempate

* [ADF-1958] Process Attachment list - The empty list should be a simple template

* changed the default empty list to a simple template

* changed process-attachment.component.html so that the user can pass custom empty tempate

* removed some unused variables

* [ADF-1958] Process Attachment list - The empty list should be a simple template

* changed the default empty list to a simple template

* changed process-attachment.component.html so that the user can pass custom empty tempate

* [ADF-2119] Document List - The pagination should be fetched from the UserPreference (#2801)

* Changed the service fetching page sizes in document-list component

* uncommented a line in process-service.component.ts for the tasklist to show page-sizes in task-list

* [no-issue] docker file (#2800)

* docker file

* cache busting for translation files (#2804)

* [ADF-1999] i18n support for file size pipe (#2803)

* i18n support for fileSize pipe

* remove unused declaration

* update unit test

* fix documentation theming

* docker nginx fix

* documentation updates (#2806)

* viewer styling improvements (#2805)

* add missing headless chrome setup for Travis (#2807)

* [ADF-2127] Started introducing new doc tools (#2809)

* try to revert karma change

* [fix-build] add stable version chrome in travis conf (#2819)

* chrome stable

* No input and No Output rename tslint rule (#2814)

* [ADF-1999] fix file size translation for 0 bytes (#2817)

* fix file size translation for 0 bytes

* update translation mock

* [ADF-2135] Updated tables of contents and tools (#2820)

* [ADF-1986] Content matadata editing phase II. (#2796)

* Aspects collection

* Fetch only those metadata aspects which are defined in the application config

* Aspect property filtering first round

* Addig wildcard support for preset, default preset fallback to wildcard, and logging

* Add white list service

* Renaming services

* ContentMetadataService and CardViewItemDispatcherComponent update

* Observables... Observables everywhere...

* Propers CardViewAspect

* Defining more interfaces

* Dummy data and expansions panels

* Fix build attempt & proper panel expansion

* Folder restructuring

* Add different type mappings

* Restructuring Card view component

* Fix build

* More ECM types supported

* Validators first phase, extraction of interfaces, world domination preparation

* Validators phase II.

* Integer and float validators

* Hide empty text items and validation message foundation

* Validation error messages for text item view, small style changes

* Update date item

* bool item component

* Datetimepicker npm module

* Datetime model

* Add mapping for datetime

* Small fixes

* Passing down preset

* Adding forgotten package.json entry

* Adding some tests for wrapper card component

* content-metadata.component tests

* Covering some edge cases, adding some tests

* Fix cardview component's test

* Add datetimepicker to demoshell

* card view component show empty values by default

* displayEmpty dependency injection

* remove table like design from cardview

* Using alfresco-js-api instead of spike

* Remove spike folder and contents

* Fix test

* Cardview updated docs

* Content metadata md

* Fix review issues

* Fix the packagr issue

* [ADF-2097] Sidebar Action Menu - New component (#2813)

SidebarMenu Component

* [no-issue] downgrade scss bundle and some other minor fix (#2824)

* downgrade scss bundle and some other minor fix

* 2.0.9

* remove chrome in travis conf

* execute different configuration

* [ADF-1769] Added JSDoc for components (#2823)

* [ADF-1769] Added JSDoc for components

* [ADF-1769] Fixed tslint error with trailing whitespace

* [ADF-2135] Updated tables of contents (#2822)

* [ADF-2054] Created a new widget to handle uploading file from Share (#2810)

* [ADF-2054] start creating custom upload widget for share integration

* [ADF-2054] changed content node selector service to allow different opening approach

* [ADF-2054] addedd support for multi resource files

* [ADF-2054] fixed base case for upload when only local files are selected

* [ADF-2054] start adding and fixing tests for new share attach button widget

* [ADF-2054] changed test to perfrom a correct check

* [ADF-2054] removed fdescribe

* [ADF-2054] added test for share-widget component

* [ADF-2054] added peer reviews changes

* [ADF-2054] created a module folder for content widgets

* [ADF-2054] fixed wrong import

* [ADF-2054] fixed rebase errors

* [ADF-2054] restored some files changed by rebase

* [ADF-2054] added link to content services to fix packaging issue

* [ADF-2054] renamed widget

* [ADF-2136] support shared links and renditions in the Viewer (#2826)

* support previewing shared link content

* remove unused router instance

* docs update

* support 'shared links' preview in the Viewer

* fallback to image preview if PDF rendition now available (#2827)

* contentActions enabling properties

* [contextMenuActions]="true" properties documentation

* [ADF-2172]Adding data-automation-id for create task/process button (#2828)

* [ADF-2152] Updated See Also sections in docs (#2830)

* [ADF-1769] Updates to prop table script (#2829)

* [ADF-1769] Fixed prop table tool formatting

* [ADF-1769] Added code style to event type column

* [ADF-2148] Update the angular and material libraries to the latest version (#2821)

* Update the angular and material library to the latest version

* [ADF-325] added attach folder widget (#2831)

[ADF-325] added new attach folder widget

*  [ADF-2053] improved search result adding refresh on delete (#2836)

* [ADF-2053] refreshed results when folder is deleted

* [ADF-2053] improved search result adding refresh on delete

* [ADF-2053] added missing whitespace

* [ADF-2120] added page size retrieving from user preference on demo shell (#2837)

* [ADF-2152] Added See Also sections and updated doc tools (#2835)

* [ADF-2152] Added See Also sections to docs

* [ADF-2152] Added doc script to package.json

* [ADF-2162] Added screenshot for Notification service (#2843)

* Fix mobile media query (#2840)

* Remove wrapping form datatable header (#2841)

* [ADF-2152] Updated See Also sections in docs (#2842)

* [ADF-2055] Ability to pre-populate form with a file and values (#2834)

* fix translations form

* fix style webpack script

* fix tslint error problem in viewer

* fix naming problems in attach file widget

* add start process form values data initialization option

* fix translation problems

* missing return type

* start process name configuration

* add CS cross PS configuration

* start process from file example

* fix minor issues

* add documentation and move the dialog in a separate component

* easy test select app

* alfrescoRepositoryName right property

* file conversion test

* fix issue after CR

* Remove forgotten semicolon.

* Fix default translation key (#2844)

* [ADF-1769] Added JSDocs and updated prop table script (#2838)

* [ADF-1769] Added JSDocs and updated prop table script

* [ADF-1769] Fixed lint error in JSDoc

* [ADF-2152] Updated See Also sections in docs (#2846)

* Add soem more explanation in the search autocomplete binding

* Rollback the upgrade libs (#2850)

* [ADF-1880] processDefinitionId parameter in adf-start-process (#2848)

* processDefinitionId parameter in adf-start-process

* fix test

* fix test

* Add @angular-devkit/core as dev dependency (#2853)

* [ADF-2183] fixed translation on no permission tooltip (#2857)

* Fix localisation in Datetimepicker (#2851)

* [ADF-2157] Infinite pagination target supporting (#2856)

* Infinite pagination target supporting

* Updating documentation

* [ADF-1769] Updated prop table script to handle inherited classes (#2855)

* [ADF-2170] fixed condition for file size equal zero (#2860)

* [ADF-2170] fixed condition for file size equal zero

* [ADF-2170] refactored if condition

* [ADF-2186] Update calculated properties on node change in content metadata compo… (#2862)

* Update calculated properties on node change in content metadata component

* Add module to public api

* [ADF-2160] Improved combined action info in Content Action component docs (#2861)

* remove processInstanceId reset (#2847)

* [ADF-2150] improved queryBody mechanism (#2852)

* [ADF-2150] changed query body parameter to a function

* [ADF-2150] added an example page where to try change query body

* [ADF-2150] improved queryBody mechanism

* [ADF-2150] fixed content node test

* [ADF-2150] extended docs added another way to use the query node

* [ADF-2150] fixed test for search on content node

* [ADF-2150] added some improvements to service config

* [ADF-2150] changed the documentation accordingly

* [ADF-2150] added PR changes

* [ADF-2150] fixed jdoc

* [ADF-2150] added checkbox to switch from service approach to input object approach

* [ADF-2150] fixed build error on demo shell

* style fixes for viewer (#2858)

* style fixes for viewer

* use theme colors

* initial theme support for PDF viewer

* [ADF-2196] fixed error message for no permission on copy and move (#2863)

* [ADF-2196] fixed error message for no permission on copy and move

* [ADF-2196] removed fdescribe

* Fix missing translation (#2867)

* Fix sidebar node reloading issue (#2866)

[ADF-2186] Fix sidebar node reloading issue

* [ADF-2201] Tidied Start Process docs (#2864)

* [ADF-2201] Tidied Start Process docs

* [ADF-2201] Removed file with probably incorrect name

* [ADF-2174] Menus background color is not properly displayed in black themes (#2859)

* [ADF-2174] Menus background color is not properly displayed in black themes

* Removed global mat-menu-panel class style overriding

* * Refactored styles

* * Changed opacity property to rgba so that injected coponents will not be affected

* Removed fixed menu width

* [ADF-2201] Tidied Content Node Dialog docs (#2870)

* Fix margin top (#2875)

* Fix dynamic table css (#2879)

* [ADF-1880] More configuration options for adf-start-process component (#2869)

* procesdefinitionId set
show dropdown multiple process

* fix sourcemap

* fix test start process

* fix test

* changes after code review

* add show dropdown optional

* remove fit fdescribe

* processDefinitionId in processDefinition change

* improve tests

* new i18n file 2.1.0 (#2878)

* [ADF-2201] Search Configuration doc (#2876)

* [ADF-2201] Updated search component docs and tidied index page

* [ADF-2201] Fixed incorrect link

* [ADF-2201] Updated docs based on feedback

* [ADF-2201] Fixed broken relative link

* Update start-process.component.md

* Update start-process.component.md

* [ADF-2201] Updated renditions service docs (#2880)

* [ADF-2208] The width of the 'New Task' option is smaller then Create Task drop down (#2881)

* Set width for menu and button

*  [ADF-2200] fixed problem with redirection url (#2877)

* [ADF-2200] fixed wrong handling of redirectUrl

* [ADF-2200] fixed problem with redirection url

* [ADF-2200] fixed redirection config path

* [ADF-2200] fixed wrong fdescribe test

* [ADF-2200] removed authserviceMock and fixed some tests

* Fix css error (#2882)

* [ADF-2188] Start Process - Change processDefinition property and fix bug (#2884)

* Change processDefinition property and fix bug

* Fix unit test

* Fix async

* Fix id

* [ADF-2200] fixed redirectUrl check (#2886)

* [ADF-2221] Search fails on Content Node Selector (#2888)

* [ADF-2201] Fixed broken links (#2890)

* export material only from the core (#2885)

* Remove app.config reference from doc (#2889)

* update versions to 2.1.0
2018-01-26 16:35:25 +00:00

19 KiB

Process Service

Manage Process Instances, Process Variables, and Process Audit Log.

Importing

import { ProcessService, ProcessInstance, ProcessInstanceVariable, 
         ProcessDefinitionRepresentation, ProcessFilterParamRepresentationModel, TaskDetailsModel } from '@alfresco/adf-process-services';

export class SomePageComponent implements OnInit {

  constructor(private processService: ProcessService) {
  }

Methods

getProcess(processInstanceId: string): Observable<ProcessInstance>

Get Process Instance metadata for passed in Process Instance ID:

const processInstanceId = '11337';
this.processService.getProcess(processInstanceId).subscribe( (processInstance: ProcessInstance) => {
  console.log('ProcessInstance: ', processInstance);
  }, error => {
    console.log('Error: ', error);
  });

The processInstanceId refers to a process instance ID for a running process in APS.
The returned processInstance object is of type ProcessInstance and looks like in this sample:

   businessKey: null
   ended: null
   graphicalNotationDefined: true
   id: "11337"
   name: "Invoice Approval 2 started from ADF client"
   processDefinitionCategory: "http://www.activiti.org/processdef"
   processDefinitionDeploymentId: "18"
   processDefinitionDescription: "This is a simple invoice approval process that allows a person to assign a dedicated approver for the the invoice. It will then be routed to the Accounting department for payment preparation. Once payment is prepared the invoice will be stored in a specific folder and an email notification will be sent."
   processDefinitionId: "InvoiceApprovalProcess:2:21"
   processDefinitionKey: "InvoiceApprovalProcess"
   processDefinitionName: "Invoice Approval Process"
   processDefinitionVersion: 2
   startFormDefined: true
   started: Tue Oct 10 2017 10:35:42 GMT+0100 (BST) {}
   startedBy: {id: 1, firstName: null, lastName: "Administrator", email: "admin@app.activiti.com"}
   suspended: false
   tenantId: "tenant_1"
   variables:  
        0: {name: "initiator", type: "string", value: "1"}
        1: {name: "approver", type: "long", value: 2002}
        2: {name: "companyemail", type: "string", value: "martin.bergljung@xxxxx.com"}
        3: {name: "invoicetobeapproved", value: null}
        4: {name: "invoiceFileName", type: "string", value: " - [Alfresco_Enterprise_Edition_3_3_Windows_Simple_Install.pdf]"}
        5: {name: "comments", value: null}
        6: {name: "form8outcome", type: "string", value: "Reject"}

startProcess(processDefinitionId: string, name: string, outcome?: string, startFormValues?: any, variables?: ProcessInstanceVariable[]): Observable<ProcessInstance>

Start a process based on passed in Process Definition, name, form values or variables.

When starting you can choose to pass in form field values or process variables (you cannot pass in both). Here is an example of how to pass in form field values, these correspond 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: 'admin@app.activiti.com',
  companyemail: 'someone@acme.com',
  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:

businessKey: null
ended: null
graphicalNotationDefined: true
id: "75001"
name: "Sample Invoice Process"
processDefinitionCategory: "http://www.activiti.org/processdef"
processDefinitionDeploymentId: "18"
processDefinitionDescription: "This is a simple invoice approval process that allows a person to assign a dedicated approver for the the invoice. It will then be routed to the Accounting department for payment preparation. Once payment is prepared the invoice will be stored in a specific folder and an email notification will be sent."
processDefinitionId: "InvoiceApprovalProcess:2:21"
processDefinitionKey: "InvoiceApprovalProcess"
processDefinitionName: "Invoice Approval Process"
processDefinitionVersion: 2
startFormDefined: false
started: Thu Nov 09 2017 08:15:37 GMT+0000 (GMT) {}
startedBy: {id: 1, firstName: null, lastName: "Administrator", email: "admin@app.activiti.com"}
tenantId: "tenant_1"
variables:
    0: {name: "approver", value: null}
    1: {name: "companyemail", type: "string", value: "someone@acme.com"}
    2: {name: "initiator", type: "string", value: "1"}
    3: {name: "invoicetobeapproved", value: null}

We can see here that the form field values have been converted to process variables.

To start the process with process variables instead of form field values do:

const processDefinitionId = 'InvoiceApprovalProcess:2:21';
const name = 'Sample Invoice Process (Var)';
const variables: ProcessInstanceVariable[] = [
  {name: 'approver', value: 'admin@app.activiti.com'},
  {name: 'companyemail', value: 'someone@acme.com'},
  {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);
});

If you want to start a process that has no start form and no process variables, then do:

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);
});

cancelProcess(processInstanceId: string): Observable<void>

Cancel a process instance by passing in its process instance ID:

const processInstanceId = '75012';
this.processService.cancelProcess(processInstanceId)
  .subscribe( response => {
  console.log('Response: ', response);
}, error => {
  console.log('Error: ', error);
});

The response is just null if the process instance was cancelled successfully. Once a Process Instance is cancelled it will show up under processes with status completed.

You typically get the processInstanceId when you start a process. It is then contained in the ProcessInstance.id response.

createOrUpdateProcessInstanceVariables(processDefinitionId: string, variables: ProcessInstanceVariable[]): Observable<ProcessInstanceVariable[]>

Create or update variables for a Process Instance:

const processInstanceId = '75001';
const variables: ProcessInstanceVariable[] = [
  {name: 'sampleVar1', value: 'hello'},
  {name: 'sampleVar2', value: 'bye'}
];
this.processService.createOrUpdateProcessInstanceVariables(processInstanceId, variables)
  .subscribe( response => {
  console.log('Response: ', response);
}, error => {
  console.log('Error: ', error);
});

The response is an array of the successfully created ProcessInstanceVariable:

Response:  
    0: {name: "sampleVar1", type: "string", value: "hello", scope: "global"}
    1: {name: "sampleVar2", type: "string", value: "bye", scope: "global"}

If a variable already exist, then its value will be updated.

Note. you need to pass in a Process Instance ID here, not a Process Definition ID.

deleteProcessInstanceVariable(processDefinitionId: string, variableName: string): Observable<void>

Delete a variable for a Process Instance:

const processInstanceId = '75001';
const variableName = 'sampleVar1';
this.processService.deleteProcessInstanceVariable(processInstanceId, variableName)
  .subscribe( response => {
  console.log('Response: ', response);
}, error => {
  console.log('Error: ', error);
});

The response will be null if the variable was successfully deleted from the Process Instance.

Note. you need to pass in a Process Instance ID here, not a Process Definition ID.

getProcessInstanceVariables(processDefinitionId: string): Observable<ProcessInstanceVariable[]>

Get all the variables for a Process Instance:

const processInstanceId = '75001';
this.processService.getProcessInstanceVariables(processInstanceId)
  .subscribe( (procVars: ProcessInstanceVariable[]) => {
  console.log('procVars: ', procVars);
}, error => {
  console.log('Error: ', error);
});

The response is an array of ProcessInstanceVariable:

procVars:  
    0: {name: "approver", scope: "global", value: null, valueUrl: null}
    1: {name: "companyemail", scope: "global", value: "someone@acme.com", valueUrl: null}
    2: {name: "initiator", scope: "global", value: "1", valueUrl: null}
    3: {name: "sampleVar2", scope: "global", value: "bye", valueUrl: null}
    4: {name: "invoicetobeapproved", scope: "global", value: null, valueUrl: null}
    5: {name: "invoiceFileName", scope: "global", value: " - [UNKNOWN]", valueUrl: null}

Note. you need to pass in a Process Instance ID here, not a Process Definition ID.

getProcessDefinitions(appId?: number): Observable<ProcessDefinitionRepresentation[]>

Get Process Definitions associated with a Process App:

const processAppId = 2;
this.processService.getProcessDefinitions(processAppId)
  .subscribe( (procDefs: ProcessDefinitionRepresentation[]) => {
  console.log('ProceDefs: ', procDefs);
}, error => {
  console.log('Error: ', error);
});

The response is an array of ProcessDefinitionRepresentation objects looking like in this example:

0:
    category: "http://www.activiti.org/processdef"
    deploymentId: "18"
    description: "This is a simple invoice approval process that allows a person to assign a dedicated approver for the the invoice. It will then be routed to the Accounting department for payment preparation. Once payment is prepared the invoice will be stored in a specific folder and an email notification will be sent."
    hasStartForm: true
    id: "InvoiceApprovalProcess:2:21"
    key: "InvoiceApprovalProcess"
    metaDataValues: []
    name: "Invoice Approval Process"
    tenantId: "tenant_1"
    version: 2

If you wanted a list of all available process definitions call the method without specifying the process application ID:

this.processService.getProcessDefinitions()
  .subscribe( (procDefs: ProcessDefinitionRepresentation[]) => {
  console.log('ProceDefs: ', procDefs);
}, error => {
  console.log('Error: ', error);
});

getProcessInstances(requestNode: ProcessFilterParamRepresentationModel, processDefinitionKey?: string): Observable<ProcessInstance[]>

Get Process Instances for passed in filter and optionally Process Definition:

const processDefKey = 'InvoiceApprovalProcess';
const filterRunningAsc = new ProcessFilterParamRepresentationModel({
'state': 'running',
'sort': 'created-asc',
});
this.processService.getProcessInstances(filterRunningAsc, processDefKey)
  .subscribe( (processInstances: ProcessInstance[]) => {
  console.log('Process Instances: ', processInstances);
}, error => {
  console.log('Error: ', error);
});

The response is an array of ProcessInstance objects as in this example:

    0: {id: "7501", name: "Invoice Approval Process - October 9th 2017", businessKey: null, processDefinitionId: "InvoiceApprovalProcess:3:2511", tenantId: "tenant_1", …}
    1: {id: "7520", name: "Invoice Approval Process - October 9th 2017", businessKey: null, processDefinitionId: "InvoiceApprovalProcess:2:21", tenantId: "tenant_1", …}
    2: {id: "8206", name: "Invoice Approval Process - October 9th 2017", businessKey: null, processDefinitionId: "InvoiceApprovalProcess:2:21", tenantId: "tenant_1", …}
    3: {id: "8302", name: "Invoice Approval Process - October 9th 2017", businessKey: null, processDefinitionId: "InvoiceApprovalProcess:2:21", tenantId: "tenant_1", …}
    4: {id: "11337", name: "Invoice Approval 2 started from ADF client", businessKey: null, processDefinitionId: "InvoiceApprovalProcess:2:21", tenantId: "tenant_1", …}
    5: {id: "11437", name: "Invoice Approval Process - October 10th 2017", businessKey: null, processDefinitionId: "InvoiceApprovalProcess:2:21", tenantId: "tenant_1", …}
    6: {id: "67143", name: "Sample Invoice Approval 2017-10-26", businessKey: null, processDefinitionId: "InvoiceApprovalProcess:5:62514", tenantId: "tenant_1", …}
    7: {id: "75001", name: "Sample Invoice Process", businessKey: null, processDefinitionId: "InvoiceApprovalProcess:2:21", tenantId: "tenant_1", …}

You can also narrow down the search via other properties in the ProcessFilterParamRepresentationModel, such as processDefinitionId and appDefinitionId. The number of Process Instances that are returned can be controlled with the page and size properties.

getProcessTasks(processInstanceId: string, state?: string): Observable<TaskDetailsModel[]>

Get Task Instances for passed in Process Instance, optionally filter by task state:

const processInstanceId = '75001';
this.processService.getProcessTasks(processInstanceId)
  .subscribe( (taskInstances: TaskDetailsModel[]) => {
  console.log('Task Instances: ', taskInstances);
}, error => {
  console.log('Error: ', error);
});

The response is an array of TaskDetailsModel objects as in this example:

{
    "size":1,
    "total":1,
    "start":0,
    "data":[
        {"id":"75010",
        "name":"Approve Invoice  - [Invoice 123]",
        "description":null,
        "category":null,
        "assignee":{"id":1,"firstName":null,"lastName":"Administrator","email":"admin@app.activiti.com"},
        "created":"2017-11-09T08:15:37.427+0000",
        "dueDate":null,
        "endDate":null,
        "duration":null,
        "priority":50,
        "parentTaskId":null,
        "parentTaskName":null,
        "processInstanceId":"75001",
        "processInstanceName":null,
        "processDefinitionId":"InvoiceApprovalProcess:2:21",
        "processDefinitionName":"Invoice Approval Process",
        "processDefinitionDescription":"This is a simple invoice approval process that allows a person to assign a dedicated approver for the the invoice. It will then be routed to the Accounting department for payment preparation. Once payment is prepared the invoice will be stored in a specific folder and an email notification will be sent.",
        "processDefinitionKey":"InvoiceApprovalProcess",
        "processDefinitionCategory":"http://www.activiti.org/processdef",
        "processDefinitionVersion":2,
        "processDefinitionDeploymentId":"18",
        "formKey":"8",
        "processInstanceStartUserId":null,
        "initiatorCanCompleteTask":false,
        "adhocTaskCanBeReassigned":false,
        "taskDefinitionKey":"approveInvoice",
        "executionId":"75001",
        "memberOfCandidateGroup":false,
        "memberOfCandidateUsers":false,
        "managerOfCandidateGroup":false
        }
        ]
}

You can also filter by task state, which can be active or completed:

const processInstanceId = '75001';
const taskState = 'active';
this.processService.getProcessTasks(processInstanceId, taskState)
  .subscribe( (taskInstances: TaskDetailsModel[]) => {
  console.log('Task Instances: ', taskInstances);
}, error => {
  console.log('Error: ', error);
});

fetchProcessAuditJsonById(processId: string): Observable<any>

Fetch Process Audit log as JSON for a Process Instance ID:

const processInstanceId = '75001';
this.processService.fetchProcessAuditJsonById(processInstanceId)
  .subscribe( auditJson => {
  console.log('Process Audit: ', auditJson);
}, error => {
  console.log('Error: ', error);
});

The response is JSON object with the Process Instance audit log:

{
  "processInstanceId": "75001",
  "processInstanceName": "Sample Invoice Process",
  "processDefinitionName": "Invoice Approval Process",
  "processDefinitionVersion": "2",
  "processInstanceStartTime": "Thu Nov 09 08:15:37 GMT 2017",
  "processInstanceEndTime": null,
  "processInstanceDurationInMillis": null,
  "processInstanceInitiator": " Administrator",
  "entries": [
    {
      "index": 1,
      "type": "startForm",
      "selectedOutcome": null,
      "formData": [
        {
          "fieldName": "Approver",
          "fieldId": "approver",
          "value": ""
        },
        {
          "fieldName": "Company Email",
          "fieldId": "companyemail",
          "value": "someone@acme.com"
        },
        {
          "fieldName": "Invoice to be approved",
          "fieldId": "invoicetobeapproved",
          "value": ""
        }
      ],
      "taskName": null,
      "taskAssignee": null,
      "activityId": null,
      "activityName": null,
      "activityType": null,
      "startTime": null,
      "endTime": null,
      "durationInMillis": null
    },
    {
      "index": 2,
      "type": "activityExecuted",
      "selectedOutcome": null,
      "formData": [],
      "taskName": null,
      "taskAssignee": null,
      "activityId": "startInvoiceProcess",
      "activityName": "Start Invoice Process",
      "activityType": "startEvent",
      "startTime": "Thu Nov 09 08:15:37 GMT 2017",
      "endTime": "Thu Nov 09 08:15:37 GMT 2017",
      "durationInMillis": 37
    },
    {
      "index": 3,
      "type": "activityExecuted",
      "selectedOutcome": null,
      "formData": [],
      "taskName": null,
      "taskAssignee": null,
      "activityId": "approveInvoice",
      "activityName": "Approve Invoice",
      "activityType": "userTask",
      "startTime": "Thu Nov 09 08:15:37 GMT 2017",
      "endTime": null,
      "durationInMillis": null
    },
    {
      "index": 4,
      "type": "taskCreated",
      "selectedOutcome": null,
      "formData": [],
      "taskName": "Approve Invoice  - [UNKNOWN]",
      "taskAssignee": " Administrator",
      "activityId": null,
      "activityName": null,
      "activityType": null,
      "startTime": "Thu Nov 09 08:15:37 GMT 2017",
      "endTime": null,
      "durationInMillis": null
    }
  ],
  "decisionInfo": {
    "calculatedValues": [],
    "appliedRules": []
  }
}

fetchProcessAuditPdfById(processId: string): Observable<Blob>

Fetch Process Audit log as a PDF for a Process Instance ID:

const processInstanceId = '75001';
this.processService.fetchProcessAuditPdfById(processInstanceId)
  .subscribe( auditPdf => {
  console.log('Process Audit log BLOB: ', auditPdf);
}, error => {
  console.log('Error: ', error);
});

The response is a BLOB as follows:

Process Audit log BLOB:  Blob {size: 124511, type: "text/xml"}