1. Update of parent record with a value from child record

    Article: AN0002417Updated: 19.03.2020

    In certains situations we are working with a class hierarchy and we are defining on the top level properties common to all the child classes and on lower levels then properties related to particular classes only. A good example is Configuration management with a common parent class: Configuration item (CI). This class contains among others also the property Responsible. It is a reference to user column. Two levels below we can see one of child classes of Configuration item class - class Business applications. This class contains also properties Administrator, Guarantor, Process analyst and Process manager, which have the same type like the property Responsible.

    Class relationships and their selected properties are displayed in the below scheme.

    It is probably no use to display the common property Responsible in the class with applications. Instead we may want to updated this property according to one of above stated properties of the child class Business applications.

    We can simply do that by creating two rules of type Script - Before saving a new record and Before saving an existing record. Below example will ensure that the property Responsible in the class Configuration items will take over the value from the property Administrator for the records of Business applications.

    OGActualDataRow['ci.responsible'] = OGActualDataRow['administrator'];