how to create a new discovery schedule via script?

runfast
Kilo Guru

I am looking to automate new discovery schedule creation (new to service-now discovery). If i have over 100 new schedules (groups by region, division etc) that needs to be created, what would be the best approach to create discovery schedules?

thanks

Alex

3 REPLIES 3

Vishal Khandve
Kilo Sage

You could create a scheduled discovery job then trigger it with a script include, see here for details on StartDiscovery method.



Discovery (Script Include) - ServiceNow Wiki



You could then call it from a client side script using GlideAjax (GlideAjax - ServiceNow Wiki ) or if you're in Geneva you could create a Scripted REST API endpoint (Create a scripted REST API resource) for your external program to call, the nice part about the latter is it's simple to create and provides a nice easy way to pass output back to your external program.




thanks,


vishal


prabhash_snow
Mega Expert

Discovery Schedules have the back end table as discovery_schedule in Servicenow.



We can always create a record in a table using various Server Side scripting framework.


But In your case, it depends on the requirement.



If getting an Excel sheet from your client to crate a DISCOVERY SCHEDULE, You can try to import it and use transform maps to directly link it to the target table (discovery_schedule) and the related tables.



You can control the transforms using the transformation script and field mapping.  



PS : This approach will save brainstorming on server side scripting.



Thanks,


Prabhash


Hi Prabhash - Thanks for providing direction. I will explore the import spreadsheet data into the table.