- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2022 11:31 AM
Step 1 : I have created a custom field named "datacertificationstatus" on cmdb_ci table
Step 2 : In OOB data certification task, if any element is certified then associated CIs in cmdb_ci table should display value as "certified" for the above custom field created in cmdb_ci table
if we certify above elements then respective CIs in cmdb_ci table should display value as "certified" for the custom field "datacertificationstatus" in cmdb_ci table
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2022 12:15 AM
Hi
There was a flaw in the script shared before where I forgot to pass the parameter correctly when it need to be certified.
So have updated the script , please use the same and test. I have tested it and works fine for me now.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var getCI = current.id;
var gettargetTable = current.table;
var getAllDetails = CheckCIColumn(getCI);
if (getAllDetails == true) {
updateCI(gettargetTable,getCI);
}
function CheckCIColumn(CI) {
var gr = new GlideRecord('cert_audit_result');
gr.addQuery('id', CI);
gr.addQuery('state','Pending'); // This will check if there are any un Certified records or not.
gr.query();
if (gr.next()) {
gs.info('There are still record which are not certified. So please certify first');
return false;
}else{
return true;
}
}
function updateCI(gettargetTable,getCI) {
var gr = new GlideRecord(gettargetTable);
gr.addQuery('sys_id', getCI);
gr.query();
if (gr.next()) {
gr.short_description = 'certified'; // Please make sure to replace "certified" with its correct back end value here and and also replace "FieldName" with the correct field name which you want to set.
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
‎02-28-2022 11:58 PM
so if both the CIs are in the same record (row ) it doesnt matter. Right?
because of relationships between tables two CIs are getting populated in the same row (record)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2022 11:22 PM
it is not working for below scenario where tasks are from query result table
In below Image, first Name is Business application CI (whiteCAS) and second Name is Mapped application service CI (white CAS - production) , if i certify this row , then the custom field "datacertificationstatus" on business application and mapped application service should get the value as "certified".
this scenario is not working with above business rule, basically target table is not business application and mapped application service in below scenario and custom field is on business application and mapped application service.
So what i wanna say is , we should be able to touch the actual tables of the CIs in particular record. IF in one record there are two CIs then we should be able to touch the actual tables of both the CIs and update the custom filed "datacertificationstatus" with the value certified.
here target table and actual tables of CIs are not matching.
please help
can you please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2022 12:19 AM
in below attached task , above br is not working, as the target table is application service so it is updating the value of "datacertificationstatus" on application service table only.
But there is one more CI (business application) with value kofax total agility it is not updating the custom field "datacertificationstatus" of business aplication for that particular CI .
here, we are not touching to the tables of both the CIs thats the reasons it is not updating the value of the custom field "datacertificationstatus" on both the tables.
can you please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2022 08:52 PM
Currently , if i certify any one element also, still the value of the custom field "datacertificationstatus" becomes 'certified' for that respective CIs.
but i want -- in particular row if I certify all the elements then only the respective CIs of that particular row should update the value of custom field "datacertificationstatus" to 'certified'
example: In the attached image, there are three elements to get certified in a single row,
application eol
application eos
architecture type
so for CI with the name (business application)Firco Trust, the value of the custom field "datacertificationstatus" should be certified only if all the three elements are certified, means all the elements in a single row should be certified then only custom field will get value as 'certified'
can you please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 01:28 AM