How to override the Default value of a base table's column?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 09:39 AM
Hi All,
We have a requirement to ignore the data transform of all CIs that are having "Empty" Lifecycle status in 'cmdb_ci_printer' table. For this requirement, we have created an ETL and there in the script, we are not having any condition to check if Lifecycle status is empty. The script only checks if Lifecycle status has any value and do the data transform to 'cmdb_ci_printer' table.
We noticed that in "cmdb_ci_printer" table (Target table ) for column "Lifecycle status" we have a default value set as '1' i.e., Installed.
The ETL script is not able to ignore data transform of BLANK lifecycle status when it has empty value coming during Data transform and makes the Lifecycle status value as "1" (Installed) by default as we have set the column default value.
We cannot remove this Default value of column in the base table 'cmdb_ci_printer'.
Is there a way to override this default value or how to ignore data transfer to 'cmdb_ci_printer' table when Lifecycle status is 'Empty' ?
ETL script logic that shows mapping should be done only when Lifecycle status is not empty.
(function(batch, output) {
for (var i = 0; i < batch.length; i++) {
var input = batch[i].input; // Value of the input column.
gs.info("lifecycle input: "+input);
if(input == "TEST 1" || input == "TEST 2" || input == "TEST 3"){
output[i]= "1"; // Lifecycle status = Installed
} else if(input == "TEST 4"){
output[i]= "5"; //Lifecycle status = "Pending Repair"
}else if(input == "TEST 5" || input == "TEST 6"){
output[i]= "4"; //Lifecycle status = "Pending Install"
}
}
})(batch, output);
cmdb_ci_printer table having "Lifecycle status" default value set as "1"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 09:56 AM
You can use dictionary override.
For example caller filed on Inc table
Right click configure dictionary
Scroll
Click new
Put table name
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 05:43 AM
Hi Atul,
Thank you for your suggestion. I created a dictionary override on 'Default value' of the "Lifecycle status" column and not setting any new default value by leaving it blank.
Concern is How to stop data transform of the BLANK value? I don't want ETL to do the data transform when Lifecycle status is coming as BLANK from source side. Basically I want to ignore any blank lifecycle status.
Please let me know if this is feasible to achieve through ETL script or Dictionary override.
Thanks in advance!
Regards,
Subhashree