"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

Yousaf
Giga Sage

Hi Omar,

Please check this link:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0958909

 

Mark Correct or Helpful if it helps.

Thanks,
Yousaf


***Mark Correct or Helpful if it helps.***

Thank you Yousaf,

I added at the end of my script the line:

new SNC.BusinessServiceManager().addCISync(grDiscServ.sys_id, null, grCCE.sys_id);

BUT still have the same error and same problem

 

 

Omar unfortunatly i am not very expert in this domain right now.

Check this doc if it can help and wait for someone more experienced.

Fix errors in individual application service maps

 

Do mark correct or helpful if you think i helped.

 


***Mark Correct or Helpful if it helps.***

Thanks Yousaf,

Really, I appreciate your help.

The "Fix errors" link shared is about errors in View Map BUT with my problem the View Map is not displayed

BR.