- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 01:43 AM
Hi,
I need to create new UI action on the device form called "Remove all installed SW"
and when click on this button I need to remove all the installed software from the device.
What am I doing wrong? the UI action is on the cmdb_ci_computer table and I need to delete all installed software on this current computer.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 03:17 AM - edited 12-22-2022 03:21 AM
Hey, The script is working fine for me.
in encodedQuery() instead of 'current.name' you may use the sys_id of the record. I have tried the same from background script it deleted the record. Just try with the sys_id -> software.addEncodedQuery('installed_on='+current.sys_id);
My background script-
var software = new GlideRecord('cmdb_software_instance');
software.addEncodedQuery('installed_on=b4fd7c8437201000deeabfc8bcbe5dc1');
software.query();
while(software.next()){
software.deleteRecord();
}
You can share the snapshot of UI action as well. I would be able to guide more but i am sure with sys_id it should work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 02:17 AM
Hey ,
I am not able to see the attached screenshot. could you help with script and configurations which you have done to achieve this requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 02:30 AM
var software = new GlideRecord('cmdb_software_instance');
software.addEncodedQuery('installed_on='+current.name);
software.query();
while(software.next()){
software.deleteRecord();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 03:17 AM - edited 12-22-2022 03:21 AM
Hey, The script is working fine for me.
in encodedQuery() instead of 'current.name' you may use the sys_id of the record. I have tried the same from background script it deleted the record. Just try with the sys_id -> software.addEncodedQuery('installed_on='+current.sys_id);
My background script-
var software = new GlideRecord('cmdb_software_instance');
software.addEncodedQuery('installed_on=b4fd7c8437201000deeabfc8bcbe5dc1');
software.query();
while(software.next()){
software.deleteRecord();
}
You can share the snapshot of UI action as well. I would be able to guide more but i am sure with sys_id it should work.