Adding Lines From Template
In the below example there are described configurational steps which lead to preparation of functionality, which in business scenario is: adding multiple recruitment tasks to recruitment form, from appointed recruitment task template.
- Creating the form for task template children (template task lines). The form should contain all the attributes which should be used for creating new task line from the task template line. There is one to one mapping while creating tasks from template lines so that is why the same attribute keys should be used in task template lines as well in destination task form.
-1a2ca361024a6c7605c14b2f2c053969.png)
Also view for the template task lines children is prepared:
-b0b0eeaee9550f12beaff31ea7eccc64.png)
- First the object type and the class and form are created for the task template header. On the form initially only Name attribute is added:
-ce2923bf0cfe811602f6ee5c09bacf41.png)
Object type for the task template header:
-fd2774711ccd7134013167ed8869e512.png)
And the class:
-14005e72eb0a51d6a1b00537614fcbbe.png)
- Creating the Object type and class for task template lines. Has to be appointed parent object type :
-d6627d7091622a5c37995c5912c5a4df.png)
As the parent key has to be appointed children attribute which will be added on the template header form.
-8b818483164c4d94eaa51b29654e53d7.png)
- Add the children attribute on template header form which appoints to the the task template lines:
-fe74433f2cffe380b03966e6b14cda68.png)
On this stage of configuration it is possible to define task template with ingredients tasks lines as children:
-059f892305ffd32f51bb8a70537bb970.png)
- It is assumed that there is already exists the 'Recruitment' form. On it, as relation view, there is defined view for recruitment tasks:
-6ec49a9e2ea49b6eea8e826606c341c7.png)
Definition of the relation view attribute for recruitment tasks:
-aa444660ad283d98e1a62e339ee73448.png)
-6a8e6939edcc34c2202ff3ab3f2312db.png)
-bc022afa32dff7189e67956378fe578e.png)
On the form assigned to 'Recruitment Task' class, there are existing the attributes with the same keys as in task template line form.
- Very important part of the setup is for the 'Recruitment Task' object type. In it's Advanced tab, there is definition of 'Templates params'. So it it important to comprehend that this definition is for the object type of destination object which is created on the basis of the template.
-5656f2b6aca8f3cb7c13d66480e98d3b.png)
{
"templateSplitLinesKey": "tempTaskLines",
"copyTemplateLineKeys": "typeRecTask,description,responsiblePersonId,status,createdFromTemp",
"filterIncludeEmptyValues": true,
"defaultTemplateKey": "defaultTemplateId",
"copyHeaderKeys": "__self=>relatedCandidate",
"orderKey": "order"
}
Comments:
- tempTaskLines - is key of children attribute placed on the task template header form. We appoint in here from which attribute in template form system should take the lines,
-
typeRecTask,description,responsiblePersonId,status,createdFromTemp - are the keys of the attributes which are existing in both: in task template line and in destination recruitment task line,
- __self=>relatedCandidate - defines that for every created task line in recruitment form, while creating the new line, system should propagate self id of the recruitment and in this manner establish relation between created task line and the recruitment header. relatedCandidate is attribute of select type of control from recruitment task to recruitment,
- order - by the value of this key in task template line, new tasks has to be added. The attribute with this key is existing in both recruitment task template line and recruitment task.
In the functional flow, when user from Recrutiment form chooses from template, then after picking the template, confirm with Next button:
-c6a4d710d932d79f2d65113dd4ad5774.png)
As the result the new tasks lines are created in recruitment form chosen template:
-ad9f3a6072924aeb537657162a32c879.png)
They are added as the next items to existing positions, incrementing by 10. It is possible to add (create) the tasks a few times from the same or different task templates to the same recruitment form.
In the case, there is only one tasks template added, after pressing 'From template' system skips selection of the template stage and creates the tasks from the only existing template.
It is worthy to emphasize 'adding in between' feature on the nested recrutiment tasks list:
-501e2082b1e0caa36b3784a4dad7f0be.png)
In such case when the plus (marked in red) button is pressed then new task with order (No) = 45 is added.
For the full explanation of the 'Template functionality parameters' please refer to: