- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2022 12:28 AM
I have created a custom table "eoleos" as shown below:
field --> Type (choice) Choices are : Operating System , Database Server , Network Device , ATM
EOL/ EOL are date and remaining all fields are string.
User will enter details in all the above fields in the custom table "eoleos".
Requirement is :
When insert or update on above table "eoleos"
if type == Operating System
then
Match Name & version/Model mentioned in above custom table with CMDB_CI table (Operating System, OS version) and update OS EOL & OS EOS of cmdb_ci table from the above custom table.
can someone help me in this requirement.
appreciate your time and efforts
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2022 04:32 AM
Couple of points to note here:
1) Updating CMDB CI table with EOL and EOS values from your custom table is okay but which class of CMDB CI you want to update here?
So please make sure you update the correct class when updating the values, I am sharing the script to be used here you just need to update the correct table Name here in script below it can be Hardware, Network or Computer or the class you want:
BR Details:
Table Name: eoleos
When: After Insert and Update
Condition: Type is Operating System
Script:
Current in script below refer to EOLOS table field object. So replace the field Name and value properly and you should be good with your requirement.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
updateCITable(current);
function updateCITable(current){
var gr = new GlideRecord('Table Name here');
gr.addQuery('name',current.name);
gr.addQuery('version',current.version);
gr.addQuery('model_id',current.model);
gr.query();
while(gr.next()){
gr.FIELD_NAME = current.EOL_FIELD_NAME;
gr.FIELD_NAME = current.EOS_FIELD_NAME;
gr.update();
}
}
})(current, previous);
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2022 06:28 AM
also many fields are not directly on cmdb_ci table then how it will work?
can we gliderecord to directly those tables, example: Hardware EOL is not on cmdb_ci so dot walking is not possible, I guess we need to directly gliderecord on cmdb_ci_hardware table.
Is my understanding correct?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2022 06:51 AM
Question - which table contain the field Hardware EOL? From which table you need to update this field value?
In case it is not in cmdb_ci then you need to glide it to (cmdb_ci_hardware) related table to which the field is created and then update the related field (for ex. Hardware EOL) then.
Hope this helps.
Mark this as Helpful/Correct, if Applicable.
Regards,
Sourabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2022 04:32 AM
Couple of points to note here:
1) Updating CMDB CI table with EOL and EOS values from your custom table is okay but which class of CMDB CI you want to update here?
So please make sure you update the correct class when updating the values, I am sharing the script to be used here you just need to update the correct table Name here in script below it can be Hardware, Network or Computer or the class you want:
BR Details:
Table Name: eoleos
When: After Insert and Update
Condition: Type is Operating System
Script:
Current in script below refer to EOLOS table field object. So replace the field Name and value properly and you should be good with your requirement.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
updateCITable(current);
function updateCITable(current){
var gr = new GlideRecord('Table Name here');
gr.addQuery('name',current.name);
gr.addQuery('version',current.version);
gr.addQuery('model_id',current.model);
gr.query();
while(gr.next()){
gr.FIELD_NAME = current.EOL_FIELD_NAME;
gr.FIELD_NAME = current.EOS_FIELD_NAME;
gr.update();
}
}
})(current, previous);
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke