Inactivate child record when parent is inactivated
Cédric BLANC
started a topic
over 2 years ago
I have two entities. If I inactivate parent record, Corresponding child record should also get inactivated. For Ex:- I have Location table and corresponding HCP location . If I make location as inactive corresponding HCP Location should also get inactivated. What could be the approach to achieve this?
Best Answer
C
Cédric BLANC
said
over 2 years ago
If you have an attribute in the parent entity called Inactive and based on that value you want to set an attribute in the child entity, you can achieve this use case using an enricher.
First you will need to create the enricher on the child entity. I have provided screenshots of my test example, I have a Department( parent) Employee (child) relationship. In the Employee entity have created this enricher
My SemQL expression is as follows
CASE when Department.Inactive ='Y' then 'Y' when Department.Inactive ='N' then 'N' else Inactive end
Once you have your expression created. I would recommend using the enricher in your form and not in a batch. Running the enricher on the form directly ensures you will get the most current value in the Department entity.
In your stepper, you will want to enable under Form enrichers > On Form Open
Now you can save and deploy your model.
In your UI, you can see now when I created a record in Department with an inactive value of Y then in the employee entity the value is automatically filled with the Y value also
If you also want to set the Inactive attribute in the child entity to read only, so that it is not editable at all, you can set that in your child entity form under Properties > General
1 Comment
Cédric BLANC
said
over 2 years ago
Answer
If you have an attribute in the parent entity called Inactive and based on that value you want to set an attribute in the child entity, you can achieve this use case using an enricher.
First you will need to create the enricher on the child entity. I have provided screenshots of my test example, I have a Department( parent) Employee (child) relationship. In the Employee entity have created this enricher
My SemQL expression is as follows
CASE when Department.Inactive ='Y' then 'Y' when Department.Inactive ='N' then 'N' else Inactive end
Once you have your expression created. I would recommend using the enricher in your form and not in a batch. Running the enricher on the form directly ensures you will get the most current value in the Department entity.
In your stepper, you will want to enable under Form enrichers > On Form Open
Now you can save and deploy your model.
In your UI, you can see now when I created a record in Department with an inactive value of Y then in the employee entity the value is automatically filled with the Y value also
If you also want to set the Inactive attribute in the child entity to read only, so that it is not editable at all, you can set that in your child entity form under Properties > General
Cédric BLANC
I have two entities. If I inactivate parent record, Corresponding child record should also get inactivated. For Ex:- I have Location table and corresponding HCP location . If I make location as inactive corresponding HCP Location should also get inactivated. What could be the approach to achieve this?
If you have an attribute in the parent entity called Inactive and based on that value you want to set an attribute in the child entity, you can achieve this use case using an enricher.
First you will need to create the enricher on the child entity. I have provided screenshots of my test example, I have a Department( parent) Employee (child) relationship. In the Employee entity have created this enricher
My SemQL expression is as follows
CASE when Department.Inactive ='Y' then 'Y' when Department.Inactive ='N' then 'N' else Inactive end
Once you have your expression created. I would recommend using the enricher in your form and not in a batch. Running the enricher on the form directly ensures you will get the most current value in the Department entity.
In your stepper, you will want to enable under Form enrichers > On Form Open
Now you can save and deploy your model.
In your UI, you can see now when I created a record in Department with an inactive value of Y then in the employee entity the value is automatically filled with the Y value also
If you also want to set the Inactive attribute in the child entity to read only, so that it is not editable at all, you can set that in your child entity form under Properties > General
Cédric BLANC
If you have an attribute in the parent entity called Inactive and based on that value you want to set an attribute in the child entity, you can achieve this use case using an enricher.
First you will need to create the enricher on the child entity. I have provided screenshots of my test example, I have a Department( parent) Employee (child) relationship. In the Employee entity have created this enricher
My SemQL expression is as follows
CASE when Department.Inactive ='Y' then 'Y' when Department.Inactive ='N' then 'N' else Inactive end
Once you have your expression created. I would recommend using the enricher in your form and not in a batch. Running the enricher on the form directly ensures you will get the most current value in the Department entity.
In your stepper, you will want to enable under Form enrichers > On Form Open
Now you can save and deploy your model.
In your UI, you can see now when I created a record in Department with an inactive value of Y then in the employee entity the value is automatically filled with the Y value also
If you also want to set the Inactive attribute in the child entity to read only, so that it is not editable at all, you can set that in your child entity form under Properties > General
-
Extend a model with new entities or attributes
-
Data types in xDM
-
Effective date on entities
-
Search using wild cards
-
Export a model from production and import on a development environment
-
"Allow Delete" vs "Allow Removal" privileges
-
LOV label in Named Query
-
Select location on a map and save coordinates
-
Is there a way to set up a master-detail relationship on browse mode?
-
Choose Either a Stepper or A Workflow Based on The User Privileges
See all 274 topics