Creating discovery source via scripts from application scope

Aditya Prasad
Tera Contributor

Hello Team, 

I am creating an graph connector application for importing devices into CMDB. I see we need to create discovery source for cmdb_ci table for this, and its in global scope. 

Is there a way to create this discovery-source in global scope and bundle this into the app or any scripts to create this inside the app ?

6 REPLIES 6

Niklas Peterson
Mega Sage
Mega Sage

Hi,

Perhaps more of a Developer question than an ITOM one.... but I'll give it a go anyway.

 

Are we talking about adding a choice record to be used by the discovery_source field? From what I can tell there is no field to tie records in the Choice (sys_choice) table to an application scope. I would assume that it means that regardless of what scope you use to create it it will still be tied to the Global scope.

 

Regards,
Niklas

Aditya Prasad
Tera Contributor

Niklas, Thanks for the response. 

Yes I can manually create it and works fine. But my requirement is to make this application file and add it to the application that I am building so that this discovery_source will be avaialable to any one who installs this app. This is where I am not getting any option to it. 

Hi,

Choice (sys_choice) table does not extend Application File (sys_metadata) so it can't be added as an Application File. I think your only option is to add a Fix Script to your application that creates the choice record.

 

https://docs.servicenow.com/bundle/vancouver-application-development/page/build/applications/concept...

 

Regards,
Niklas

Aditya Prasad
Tera Contributor

Niklas, Thanks for the response. 

I had tried this, but even fix script does not allow cross scope access. Since choice list is in global scope, we might need to some extra step to allow app to create it via script. And I am not able to identify that extra step.