Maurizio Vitale 1fa81962a0
👽 Angular 14 rebase 👽 (#7769)
* fix after rebase

* new release strategy for ng next

Signed-off-by: eromano <eugenioromano16@gmail.com>

* peer dep

Signed-off-by: eromano <eugenioromano16@gmail.com>

* Angular 14

fix unit test and storybook

Signed-off-by: eromano <eugenioromano16@gmail.com>

fix after rebase

Signed-off-by: eromano <eugenioromano16@gmail.com>

update pkg.json

Signed-off-by: eromano <eugenioromano16@gmail.com>

missing dep

Signed-off-by: eromano <eugenioromano16@gmail.com>

Fix mistake and missing code

Dream....build only affected libs

Add utility run commands

* Use nx command to run affected tests

* Fix nx test core

fix content tests

Run unit with watch false

core test fixes

reduce test warnings

Fix process cloud unit

Fix adf unit test

Fix lint process cloud

Disable lint next line

Use right core path

Fix insights unit

fix linting insights

Fix process-services unit

fix the extensions test report

fix test warnings

Fix content unit

Fix bunch of content unit

* Produce an adf alpha of 14

* hopefully fixing the content

* Push back the npm publish

* Remove flaky unit

* Fix linting

* Make the branch as root

* Get rid of angualar13

* Remove the travis depth

* Fixing version for npm

* Enabling cache for unit and build

* Fix scss for core and paths

Copy i18 and asset by using ng-packager

Export the theming alias and fix path

Use ng-package to copy assets process-services-cloud

Use ng-package to copy assets process-services

Use ng-package to copy assets content-services

Use ng-package to copy assets insights

* feat: fix api secondary entry point

* fix storybook rebase

* Move dist under dist/libs from lib/dist

* Fix the webstyle

* Use only necessary nrwl deps and improve lint

* Fix unit for libs

* Convert lint.sh to targets - improve performance

* Use latest of angular

* Align alfresco-js-api

Signed-off-by: eromano <eugenioromano16@gmail.com>
Co-authored-by: eromano <eugenioromano16@gmail.com>
Co-authored-by: Mikolaj Serwicki <mikolaj.serwicki@hyland.com>
Co-authored-by: Tomasz <tomasz.gnyp@hyland.com>
2022-08-25 10:50:30 +01:00

8.1 KiB

Title, Added, Status, Last reviewed
Title Added Status Last reviewed
Start Process component v2.0.0 Active 2019-01-14

Start Process component

Starts a process.

adf-start-process

Contents

Basic Usage

<adf-start-process 
   [appId]="YOUR_APP_ID">
</adf-start-process>

Class members

Properties

Name Type Default value Description
appId number (optional) Limit the list of processes that can be started to those contained in the specified app.
name string "" (optional) Name to assign to the current process.
processDefinitionName string (optional) Definition name of the process to start.
processFilterSelector boolean true (optional) Parameter to enable selection of process when filtering.
showSelectApplicationDropdown boolean false (optional) Hide or show application selection dropdown.
showSelectProcessDropdown boolean true Hide or show the process selection dropdown.
title string (optional) Define the header of the component.
values FormValues Parameter to pass form field values in the start form if one is associated.
variables ProcessInstanceVariable[] Variables in the input to the process RestVariable.

Events

Name Type Description
applicationSelection EventEmitter<AppDefinitionRepresentationModel> Emitted when application selection changes.
cancel EventEmitter<void> Emitted when the process is canceled.
error EventEmitter<any> Emitted when an error occurs.
processDefinitionSelection EventEmitter<ProcessDefinitionRepresentation> Emitted when process definition selection changes.
start EventEmitter<ProcessInstance> Emitted when the process starts.

Details

Starting a process with a default name and pre-selected process definition name

 <adf-start-process 
      [appId]="YOUR_APP_ID"
      [title]="'ADF_PROCESS_LIST.START_PROCESS.FORM.TITLE'"
      [name]="PROCESS_NAME"
      [processDefinitionName]="PROCESS_DEFINITION_NAME">
 </adf-start-process>		 

You can use the processDefinitionName property to select which process will be selected by default on the dropdown (when there is more than one process to choose from). Use the name property to set the name shown on the dropdown item.

Starting a process not included in an app

 <adf-start-process 
      [processDefinitionName]="PROCESS_DEFINITION_NAME">
 </adf-start-process>		 

Use processDefinitionName to set the dropdown item as in the example above.

Custom data example

The following example shows how to pass in form field values to initialize the start form for the process:

const formValues: FormValues  = {
    'test_1': 'value_1',
    'test_2': 'value_2',
    'test_3': 'value_1',
    'test_4': 'dropdown_id',
    'test_5': 'dropdown_label',
    'dropdown': {'id': 'dropdown_id', 'name': 'dropdown_label'}
};
<adf-start-process 
    [values]="formValues"
    [appId]="YOUR_APP_ID" >
</adf-start-process>

Attaching a File to the start form of the process

You can see a repository in the Alfresco Repositories list once it is created in APS. If the repository is set up with an ID value of anything other than 1 then you will need to declare it in app.config.json. For example, if the repository's ID is 1002 and its name is alfresco then you would set the alfrescoRepositoryName property inapp.config.json to alfresco-1002 as follows:

{
    "application": {
        "name": "Alfresco ADF Application"
    },
    "ecmHost": "http://{hostname}{:port}/ecm",
    "bpmHost": "http://{hostname}{:port}/bpm",
    "logLevel": "silent",
    "alfrescoRepositoryName": "alfresco-1002"
}       

You then need to pass the node as the input values object with the other properties:

let node: MinimalNode = null;

 this.nodesApiService.getNode(NODE_ID).subscribe((minimalNode) => this.node = minimalNode);

const formValues: FormValues  = {
    'file' : node
    'field_one': 'example text'
};

You could pass multiple nodes too:

const nodes: string[] = [NODE_ID_1, NODE_ID_2];

const values: FormValues = {
        'files': []
      };

      Observable.from(nodes)
        .flatMap((nodeId) => this.nodesApiService.getNode(nodeId))
        .subscribe(
              (node) => {
                values.files.push(node);
              },
              (error) => console.log(error) ,
              () => {
                this.formValues = values;
              });
    });

Note that in the object above, the key file is the name of the attach file field in the start form of the process. The value of the file property must be a MinimalNode:

<adf-start-process 
    [values]="formValues"
    [appId]="YOUR_APP_ID" >
</adf-start-process>

The result will be the start form prefilled with the file data:

Start process load file

Starting a process with a selected application

Now you can start process based on selected application from the dropdown. The process definition dropdown will display based on the selected application. The application dropdown will be selected application based on the given appId otherwise first application will be selected as default.

 <adf-start-process 
      [appId]="YOUR_APP_ID"
      [title]="'ADF_PROCESS_LIST.START_PROCESS.FORM.TITLE'"
      [name]="PROCESS_NAME"
      [showSelectApplicationDropdown]="true"
      [processDefinitionName]="PROCESS_DEFINITION_NAME">
 </adf-start-process>		 

You can use the showSelectApplicationDropdown property to Hide or show application drop down.

Start process with selected application

Error handling

When an error occurs, the component will emit an error event that can be used to handle errors. Example:

 <adf-start-process 
      [appId]="YOUR_APP_ID"
      [title]="'ADF_PROCESS_LIST.START_PROCESS.FORM.TITLE'"
      [name]="PROCESS_NAME"
      (error)="onError($event)">
 </adf-start-process>		 
    onError(error) {
        this.notificationService.showError(event.response.body.message);
    }

See also