Issue
If you need to stop a Service Mapping discovery process for a business service, this guide shows you how to cancel discovery using a background script.
Release
Any supported release
Resolution
Before you begin, verify that you have:
- Administrator access to your ServiceNow instance
- The Business Service ID (sys_id) for the service you want to stop
Find your Business Service ID
- Go to Service Mapping > Business Services.
- Locate the Business Service where you want to cancel discovery.
- Copy the sys_id from the record
- The sys_id is a 32-character unique identifier
- Example: 0123456789abcdef0123456789abcdef
Run the cancellation script
- In the navigation filter, type background script
- Select Background Scripts from the results
- In the script editor, paste this code:
var cancelBS = new CancelBSDiscovery(); cancelBS.cancelAll("your_business_service_sys_id_here");
- Replace your_business_service_sys_id_here with the actual sys_id.
- Select Run script.
Example script with sample sys_id:
var cancelBS = new CancelBSDiscovery(); cancelBS.cancelAll("0123456789abcdef0123456789abcdef");
Verify the cancellation
To confirm discovery was canceled:
- Go to Service Mapping > Discovery Status
- Check that the discovery status shows as canceled.
- Review the discovery logs for confirmation messages.