"This service is empty. Add some entrypoints on the service form" error when creating Mapped Application Service and Entry Point by script

Omar MOUMEN
Kilo Guru

Hi,

I'm trying to create by code (Not with UI) a Mapped Application Service and its Entry Point using a Script-Background. All the records are well inserted in the corresponding tables (cmdb_ci_service_discovered, cmdb_ci_endpoint_http, sa_m2m_service_entry_point, and svc_ci_assoc); I check them by UI BUT the View Map show an Error (see attached screenshot).

SCRIPT-BACKGROUND:

var grDiscServ = new GlideRecord('cmdb_ci_service_discovered');       
        grDiscServ.initialize();
        grDiscServ.name = 'Ticket-Monster';      
        grDiscServ.operational_status = '2';
        grDiscServ.discovery_status = '1';
        grDiscServ.traffic_discovery = false;
        grDiscServ.source = 'Manual';
        grDiscServ.type = '2';      
        grDiscServ.insert();

        var grCCE = new GlideRecord('cmdb_ci_endpoint_http');
        grCCE.initialize();
        grCCE.url = 'http://198.51.100.12/ticket-monster';
        grCCE.protocol = 'http';
        grCCE.host = '198.51.100.12';
        grCCE.ip_address = '198.51.100.12';
        grCCE.port = '80';
        grCCE.discovery_source = 'ServiceWatch';        
        grCCE.insert();

        var grSM2SEP = new GlideRecord('sa_m2m_service_entry_point');
        grSM2SEP.initialize();
        grSM2SEP.cmdb_ci_endpoint = grCCE.sys_id;
        grSM2SEP.cmdb_ci_service = grDiscServ.sys_id;
        grSM2SEP.insert();      

        var grSCA = new GlideRecord('svc_ci_assoc');
        grSCA.initialize();
        grSCA.setValue('service_id', grDiscServ.sys_id);
        grSCA.setValue('ci_id', grCCE.sys_id);
        grSCA.insert();
        grSCA.initialize();
        grSCA.setValue('service_id', grDiscServ.sys_id);
        grSCA.setValue('ci_id', grDiscServ.sys_id);
        grSCA.insert();
1 ACCEPTED SOLUTION

Omar MOUMEN
Kilo Guru

Steps to automate the service mapping of an Application Service (AS):

- Create the AS record in the Application Service (cmdb_ci_service_auto) table.

- According to the AS Entry Point (EP) type, create a record in the corresponding Endpoint table (cmdb_ci_endpoint_<EP Type>).

- Link the Endpoint record to the AS as an EP in the Entry Point (sa_m2m_service_entry_point) table.

- Reclassify the AS record to the Mapped Application Service (cmdb_ci_service_discovered) table and Populate the Discovered Service. The "Convert to Application Service" UI Action can be very helpful.

- Update the Sa Endpoint Status "sa_endpoint_status" table that the service discovering of the AS start automatically.

View solution in original post

7 REPLIES 7

Omar MOUMEN
Kilo Guru

Steps to automate the service mapping of an Application Service (AS):

- Create the AS record in the Application Service (cmdb_ci_service_auto) table.

- According to the AS Entry Point (EP) type, create a record in the corresponding Endpoint table (cmdb_ci_endpoint_<EP Type>).

- Link the Endpoint record to the AS as an EP in the Entry Point (sa_m2m_service_entry_point) table.

- Reclassify the AS record to the Mapped Application Service (cmdb_ci_service_discovered) table and Populate the Discovered Service. The "Convert to Application Service" UI Action can be very helpful.

- Update the Sa Endpoint Status "sa_endpoint_status" table that the service discovering of the AS start automatically.

Hi Omar,

From Vancouver release, you can use method AddEntryPoint from BusinessServiceManager() API.

 

Check following doc from developer site:

https://developer.servicenow.com/dev.do#!/reference/api/vancouver/server_legacy/BusinessServiceManag...

 

Kindest Regards,

 

RD

Hello Omar,

 

Me also trying something like this you have tried , i would like to understand little more on below two points

- Reclassify the AS record to the Mapped Application Service (cmdb_ci_service_discovered) table and Populate the Discovered Service. The "Convert to Application Service" UI Action can be very helpful.

- Update the Sa Endpoint Status "sa_endpoint_status" table that the service discovering of the AS start automatically.

 

could you please elaborate more on this as in what exactly need to done in this two steps.