Deleting configuration items
If you have CIs that are no longer being used or you are discarding them, such as old hardware, you can delete these CIs to ensure that you have an accurate representation of the CIs in your IT environment. When you delete a CI from the database, all relationships associated with that CI are also deleted.
Note
If you do not have the Delete permission on the class of an asset, you cannot delete the assets of that class; the Delete toolbar icon for the assets of that class is disabled.
To delete a configuration item
- Click the Remedyforce CMDB tab.
- In the right pane of the CMDB Manager, select the CI that you want to delete.
To search for a CI, type initial characters of the name of the CI or the full name of the class name in the Search text box and click Search .
For example, to search for Email Service CI, you can type Email or Email Service in the Search text box and click Search. You can also search using data in the Instance ID, Instance Name, Description, Class Name, Asset #, Token ID, and Serial # fields. If you select a class in the left navigation pane, only the CIs of that class are searched. To search all classes, select the Base Element class in the left navigation pane. Click Delete.
Note
If you do not have the Update and Delete CMDB user permission for CI Management View, the Delete toolbar icon for the CIs of a class is disabled. If both CI and asset management are enabled, to be able to delete a CMDB instance of the instance type CI/Asset from the All tab of Remedyforce CMDB, you must have Update and Delete CMDB user permission for both CI Management View and Asset Management View. Otherwise, the Delete toolbar icon is disabled.
- In the confirmation dialog box, click Yes.
You can delete one or more CIs from the Base Element
object of the CMDB by using Salesforce Object Query Language (SOQL) query, Salesforce page layout, the data loader, or the Pentaho Data Integration tool. When you delete a CI, the CI relationships, CI client links, and CI tasks links are also deleted.
Deleting a CI and asset record
When both CI and IT asset management are enabled, if you select a CI/Asset instance and click Delete, the following delete options are available based on your CMDB user permissions and the tab that you have selected on the left navigation pane of the Remedyforce CMDB tab:
Tab on the left navigation pane | Available delete options |
---|---|
CI |
|
Asset |
|
All |
|
To delete configuration items by using the Developer Console
- Navigate to the Developer Console.
- Click the text box next to the Execute button.
- Enter a script to delete the CIs. BMC recommends that the batch size for the query should be 50.
- Example: To delete CIs that are marked to be deleted from a specific CI class, use the following script:
Delete [Select ID From BMCServiceDesk__BMC_BaseElement__c where BMCServiceDesk__class__c = 'BMC_IPEndpoint' AND BMCServiceDesk__MarkAsDeleted__c = TRUE Limit 50]
- Example: To delete records from a CI class based on which Rule Based Asset classes are defined, use the following script:
List< BMCServiceDesk__BMC_BaseElement__c> BEList = [select Id, BMCServiceDesk__InstanceType__c, BMCServiceDesk__DeleteStatusCode__c from BMCServiceDesk__BMC_BaseElement__c where BMCServiceDesk__class__c = 'BMC_ComputerSystem' Limit 50];
List<BMCServiceDesk__BMC_BaseElement__c> updInstList = new List<BMCServiceDesk__BMC_BaseElement__c>();
List<BMCServiceDesk__BMC_BaseElement__c> delInstList = new List<BMCServiceDesk__BMC_BaseElement__c>();
for(BMCServiceDesk__BMC_BaseElement__c inst : BEList){if(String.valueOf(inst.BMCServiceDesk__InstanceType__c) == 'CI / Asset')
inst. BMCServiceDesk__DeleteStatusCode__c = 2;
updInstList.add(inst);
}else{
delInstList.add(inst);
}
}if(updInstList != null && updInstList.size() > 0){
update updInstList;
}
if(delInstList != null && delInstList.size() > 0){
delete delInstList;
}
- Example: To permanently delete the records from a CI, asset, or CI and Asset class, use the following script:
List<BMCServiceDesk__BMC_BaseElement__c> BEList = [select Id from BMCServiceDesk__BMC_BaseElement__c where BMCServiceDesk__class__c = 'BMC_IPEndpoint' Limit 50];
delete BEList;
Example: To delete only CIs from a CI and Asset class:
List< BMCServiceDesk__BMC_BaseElement__c> BEList = [select Id, BMCServiceDesk__DeleteStatusCode__c from BMCServiceDesk__BMC_BaseElement__c where BMCServiceDesk__FKAssetRuleClass__r. BMCServiceDesk__ClassName__c = 'BMC_Monitor' Limit 50];
for(BMCServiceDesk__BMC_BaseElement__c inst : BEList){
inst. BMCServiceDesk__DeleteStatusCode__c = 2;
}
update BEList;
- Click Execute.
Comments
Log in or register to comment.