Equipment purchase request process. Adding a reference list. Non-default journal and form

Note

This article continues working with the previously created business process Equipment purchase request

Reference list “Equipment Type”

Note

To create a data type, go to the administrator workspace, in the Model section go to Data Types:

Let’s add a reference list “Equipment Type” that we will use in the equipment purchase request.

Reference list (datalist) - a type for storing a dataset that will be used as static data for documents not directly involved in business processes.

To create a data type, go to the administrator workspace, in the Model section go to Data Types:

../_images/adm_ws.png

../_images/type_new_1.png

click + - Create new type:

../_images/type_new_2.png

Basic

The tab contains basic data about the data type (object):

1

id

equipment-type

2

Name

Equipment Type

3

Parent

Reference list

4

Display Name Template

${type}

5

Form

Leave as default (the system will automatically generate a form based on the attributes we specify later, but automatically generated forms cannot be edited)

6

Journal

Leave as default (the system will automatically generate a journal based on the attributes we specify later, but automatically generated journals cannot be edited)

Final tab configuration:

../_images/035.png

Attributes

Fill in the following attributes (object properties):

Id (1)

Name (2)

Type (3)

type

Title

Text

../_images/044.png

Click «Save».

Add the type$equipment-type journal to the menu, similar to how it’s described in article and fill it with data:

../_images/04_1.png

Data Type

Adding an additional attribute

Next, add the “Equipment Type” attribute to the existing data type. Find the “Equipment Purchase Request” data type, switch to edit mode:

../_images/053.png

On the “Attributes” tab, click “+Add more” and fill the row with the following data:

../_images/064.png

Id (1)

Name (2)

Type (3)

type

Type

Association

Click “Configure”:

../_images/074.png

Click “Select” and choose “Equipment Type” from the data types list:



Move the added row below the Equipment Name row:

../_images/101.png

Let’s also add the Approver’s Comment attribute, which we’ll later add to the approval form as well.

Id (1)

Name (2)

Type (3)

attributeForComment

Approver’s Comment

Text

../_images/attributeForComment.png

Numbering Template

Note

To create a numbering template, go to the local workspace, in the Administration section go to Numbering Templates.

Numbers can be assigned automatically. And the number can be reflected in the display name template. For this, you need to set up and configure Numbering Template

Go to the “Basic” tab:

../_images/112.png

In the “Numbering Template” field, click “Select”. Then click “Create - Create new template”:

../_images/121.png

Fill in the opened form:

../_images/131.png

No.

Field

Value

1

id

equipment-request-number-template

2

Name

Equipment Request Number Template

3

Counter key

equipment-request-counter

And select the created template:

../_images/14.png

In the “Display Name Template” field, specify Request_${_docNum}:

../_images/15.png

Non-default journal and form

Automatically generated form and journal were created for the data type, but they cannot be edited.

../_images/161.png

Adding fields to the journal

Go to the data type and to copy the journal, click:

../_images/171.png

A form with a default name will open:

../_images/18.png

Rename to equipment-request and click “Confirm”:

../_images/18_1.png

After saving, a new journal is created and the auto-generated journal in the data type is replaced with the created one.

To edit it, click:

../_images/19.png

A journal will open where you can make changes:

../_images/20.png

Next, let’s add system fields (link) to the journal, similar to how we added Equipment Type above:

  • _created- date and time of object creation. Select data type “Date”

  • _disp - display name (since we set the Display Name Template above, the field will show Request_ {Number})

  • _status - object status

Click “+Add” and fill the rows with the following data:

../_images/21.png

Click «Save».

Note

  • Add the equipment-request journal to the menu, similar to how it’s described

  • Remove the auto-generated type$equipment-request journal from the menu.

Open the “Equipment Purchase Request” journal. New columns have been added to it.

../_images/21_1.png

Changing form fields

Go to the data type and to copy the form, click:

../_images/22.png

A form with a default name will open:

../_images/23.png

Rename to equipment-request and click “Confirm”:

../_images/23_1.png

After saving, a new form is created and the auto-generated form in the data type is replaced with the created one. To edit it, click:

../_images/24.png

A form will open where you can make changes.

../_images/24_1.png

To switch to component editing, click “Edit form”.

../_images/25.png

Make the following changes:

Using drag and drop, move the “Type” field above under the “Equipment Name” field.

../_images/25_1.png

Let’s make the “Equipment Name” field mandatory. To switch to component editing, click:

../_images/26.png

A component properties editing form will open with a preview on the right side:

../_images/27.png

On the “Basic” tab, check the “Mandatory” (1) checkbox and save (2).

In the “Equipment Type” field, let’s specify the default type. On the “Data” tab:

../_images/281.png

select the default value:

../_images/291.png

../_images/301.png

Click «Save».

In the “Initiator” field, let’s configure it so that the user creating the request is automatically specified. On the “Custom” tab, check the “Current user by default” checkbox and save.

../_images/311.png

The “Approver’s Comment” field will be filled during approval. So when creating a request, let’s disable data entry in it:

../_images/attributeForComment_form.png

Click «Save».

Edited form:

../_images/32.png

../_images/33.png

Click «Save».

Go to the “Equipment Purchase Request” journal and click +. The form fields have been changed:

../_images/34.png

Adding approver’s comment saving to the request

The “Approver’s Comment” attribute has been added to the data type and the form. Now you need to:

  • (1) add the attribute to the task form “Under approval by approver”;

  • (2) add a Script task element to the business process.

../_images/comment_to_bp.png

Adding attribute to form (1)

  • Go to the user task “Under approval by approver” component and then to form editing mode:

    ../_images/comment_to_form_01.png
  • Click “Edit form”:

    ../_images/comment_to_form_02.png
  • Select the Text area component, since the comment may contain many characters:

    ../_images/comment_to_form_03.png
  • Specify:

    • Field name - Approver’s Comment

    • Property name - comment

    Click «Save».

    ../_images/comment_to_form_04.png
  • Save the form:

    ../_images/comment_to_form_05.png

Adding script to process (2)

Between the user task “Under approval by approver” and Gateway elements, you need to add a script task.

  • Using free selection (1), select and move the elements to the left:

    ../_images/comment_to_bp_01.png
  • In the menu, select the “Task” element and drag it after the user task “Under approval by approver”:

    ../_images/comment_to_bp_02.png
  • Change its type to Script task:

    ../_images/comment_to_bp_03.png
  • Specify:

    • Name - “Saving comment”,

    • in Script:

    document.att('attributeForComment', comment);
    document.save();
    
    ../_images/comment_to_bp_04.png

Save and publish the process:

../_images/comment_to_bp_05.png

To test the process, create a request, send it for approval, it will be assigned a number like Request_N. If the approver adds a comment to the task:

If the approver adds a comment to the task:

../_images/comment_01.png

then it will be saved in the request card:

../_images/comment_02.png