---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# BusinessServiceManager - Global

# BusinessServiceManager - Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 7 minutes to read

The BusinessServiceManager API provides methods that unify service management by converting manually-created services to application services, populating application services, and adding/removing
configuration items and connections.

Use BusinessServiceManager methods in global server scripts. You must have the Application Service administrator \[app_service_admin\] role to call this API.

## BusinessServiceManager - BusinessServiceManager() {#ariaid-title2}

Instantiates a BusinessServiceManager object.
{#BSM-BusinessServiceManager__table_djw_xl5_ndb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#BSM-BusinessServiceManager__table_djw_xl5_ndb}  

    var bsManager = new SNC.BusinessServiceManager();

## BusinessServiceManager - addCI(String service_id, String source_id, String
target_id) {#ariaid-title3}

Adds a CI to a manually-created application service.
{#BSM-addCI_S_S_S__table_ihq_zl5_ndb__entry__3}

| Name | Type | Description |
|-|-|-|
| service_id | String | Sys_id of the application service to add a CI to. Must be of type cmdb_ci_service_discovered. |
| source_id | String | Sys_id of the CI whose outgoing connection joins the target CI. |
| target_id | String | Sys_id of the CI to add to the service. Cannot be an excluded item. Excluded items are CIs configured in the Manual CI Inclusions/Exclusions \[svc_manual_ci_exclusions_inclusions.list\] table. |
[Table 2. Parameters]

{#BSM-addCI_S_S_S__table_ihq_zl5_ndb} {#BSM-addCI_S_S_S__table_jhq_zl5_ndb__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 3. Returns]

{#BSM-addCI_S_S_S__table_jhq_zl5_ndb}  

    //Application service is 'PeopleSoft Portals'
    //Source CI is windows server 'PS Apache01'
    //Target CI is 'SAP WEB01'

    var bsManager = new SNC.BusinessServiceManager();
    var appService = bsManager.addCI('2fce42d80a0a0bb4004af34d7e3984c8','3a27d4370a0a0bb4006316812bf45439', '3a6cadc1c0a8ce01001f1e5d0d7d68fa');

### Add a new entry point {#BSM-addCI_S_S_S__section_ckd_wqg_cvb}

Use the addCI() method to add a new entry point to a service by providing the following parameter values in your request:

* Provide the service_ID as normal.
* Leave the source_ID value empty. For example, use `''`.
* For target_ID, enter the Sys ID of the CI under which to add the new entry point.
{#BSM-addCI_S_S_S__ul_s3g_cqm_cvb}  
As a result, the addCI() method creates a new entry point with a connection to the specified target CI. The following is an example of how to add a new entry point:

    //Application service sys_id is '49de2b3187cd9d50d5c8a6880cbb35ea' 
    //Source CI is passed as an empty string as '' 
    //Target CI sys id is '15ca5fb187129910d5c8a6880cbb3537'   

    var bsManager = new SNC.BusinessServiceManager(); 
    var appService = bsManager.addCI('49de2b3187cd9d50d5c8a6880cbb35ea','', '15ca5fb187129910d5c8a6880cbb3537');

## BusinessServiceManager - addEntryPoint(serviceId, endpointGr) {#ariaid-title4}

Adds an entry point to the application service and starts discovery on the entry point.
{#BSM-addEntryPoint_S_O__table_clj_sw2_zwb__entry__3}

| Name | Type | Description |
|-|-|-|
| serviceId | Sting | Sys_id of the application service to add the connection to. |
| endpointGr | String | Glide Record object in the CI Endpoint \[cmdb_ci_endpoint\] table or its child table to add to the application service. |
[Table 4. Parameters]

{#BSM-addEntryPoint_S_O__table_clj_sw2_zwb} {#BSM-addEntryPoint_S_O__table_dlj_sw2_zwb__entry__2}

| Type | Description |
|-|-|
| Boolean | Flag indicating the entry point was successfully added to the application service. Possible values: * true: the addition was successful. * false: the addition was not successful. {#BSM-addEntryPoint_S_O__ul_f52_dg2_zwb} |
[Table 5. Returns]

{#BSM-addEntryPoint_S_O__table_dlj_sw2_zwb}  
The following addEntryPoint() method shows how to add a new entry point to the application service.

    var now_GR = new GlideRecord("cmdb_ci_endpoint_tcp");
    now_GR.initialize(); 
    now_GR.setValue("host", "10.196.39.251");
    now_GR.setValue("port", "8080");
    now_GR.insert();
    var bsManager = new SNC.BusinessServiceManager();
    var serviceId = "5bf65ebeedb91300964f6fa662989533";
    bsManager.addEntryPoint(serviceId,now_GR);

Output:

    true

## BusinessServiceManager - addEntryPointWithoutStartDiscovery(serviceId, endpointGr) {#ariaid-title5}

Adds a new entry point without starting discovery.
{#BSM-addEntryPtWoStartDiscovery_S_O__table_at2_252_zwb__entry__3}

| Name | Type | Description |
|-|-|-|
| serviceId | String | Sys_id of the application service to add the connection to. |
| endpointGr | String | Glide Record object in the CI Endpoint \[cmdb_ci_endpoint\] table or its child table to add to the application service. |
[Table 6. Parameters]

{#BSM-addEntryPtWoStartDiscovery_S_O__table_at2_252_zwb} {#BSM-addEntryPtWoStartDiscovery_S_O__table_bt2_252_zwb__entry__2}

| Type | Description |
|-|-|
| Boolean | Flag indicating the entry point was successfully added to the application service. Possible values: * true: the addition was successful. * false: the addition was not successful. {#BSM-addEntryPtWoStartDiscovery_S_O__ul_f52_dg2_zwb} |
[Table 7. Returns]

{#BSM-addEntryPtWoStartDiscovery_S_O__table_bt2_252_zwb}  
The following example shows how to use the addEntryPointWithoutStartDiscovery() method to add a new entry point to the application service without initiating discovery.

    var now_GR = new GlideRecord("cmdb_ci_endpoint_tcp");
    now_GR.initialize(); 
    now_GR.setValue("host", "10.196.39.251");
    now_GR.setValue("port", "8080");
    now_GR.insert();
    var bsManager = new SNC.BusinessServiceManager();
    var serviceId = "5bf65ebeedb91300964f6fa662989533";
    bsManager.addEntryPointWithoutStartDiscovery(serviceId,now_GR);

Output:

    true

## BusinessServiceManager - addManualConnection(String source_id, Object manual_endpoint,
String service_id) {#ariaid-title6}

Adds a manually created connection to an application service.
{#BSM-addManualConnection_S_O_S__table_fkl_1bb_sdb__entry__3}

| Name | Type | Description |
|-|-|-|
| source_id | String | Sys ID of the CI to add to the connection. |
| manual_endpoint | Object | GlideRecord object in the cmdb_ci_endpoint_manual table to add to the application service. |
| service_id | String | Sys ID of the application service to add the connection to. |
[Table 8. Parameters]

{#BSM-addManualConnection_S_O_S__table_fkl_1bb_sdb} {#BSM-addManualConnection_S_O_S__table_gkl_1bb_sdb__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 9. Returns]

{#BSM-addManualConnection_S_O_S__table_gkl_1bb_sdb}  

    var now_GR = new GlideRecord("cmdb_ci_endpoint_manual");
    now_GR.initialize(); 
    now_GR.name='myEndpoint'; 
    now_GR.insert();

    var bsManager = new SNC.BusinessServiceManager();
    var appService = bsManager.addManualConnection("3a307c930a0a0bb400353965d0b8861f", now_GR, "2fce42d80a0a0bb4004af34d7e3984c8");

## BusinessServiceManager - isReadingPermitted(Object gr, String userSysID) {#ariaid-title7}

Checks the roles of a specified user and the permissions data configured for a specified service/service group and returns a Boolean value that indicates whether the user can view the service/service group.
The following defines the process flow that the method uses to determine whether the user can view the service/service group:  
1. If the specified record is a service group, checks the user roles and group policy. For more information on assigned roles for service groups, see [Assign a role to a service group](https://www.servicenow.com/docs/access?context=t_EMAssignRoleSvcGroup&version=xanadu&pubname=xanadu-it-operations-management&ft:locale=en-US).
2. If the roles list contains "itil" but doesn't contain "app_service_admin" and "sam_core_user", return true.
3. If the roles list contains "maint", return true.
4. If the roles list contains "app_serivce_user" but doesn't contain "app_service_admin" and "sm_app_owner", and the service isn't operational, return false.
5. Check the group of the service.
   1. If the service belongs to a single group, and the group is "all", return true.
   2. For any non "all" group, checks the policy for user roles and group based on the rules specified in [Assign a role to a service group](https://www.servicenow.com/docs/access?context=t_EMAssignRoleSvcGroup&version=xanadu&pubname=xanadu-it-operations-management&ft:locale=en-US). If any of them returns true, return true.
   {#BSM-isReadingPermitted_O_S__ol_wrc_tjy_dzb}
{#BSM-isReadingPermitted_O_S__table_snj_253_kyb__entry__3}

| Name | Type | Description |
|-|-|-|
| gr | GlideRecord | GlideRecord of the service/service group. This GlideRecord can be from one of the following tables: * Application Service \[cmdb_ci_service_auto\] * Application Service Group \[cmdb_ci_service_group\] * Dynamic CI Group \[cmdb_ci_query_based_service\] * Manual Services \[cmdb_ci_service_manual\] * Mapped Application Service \[cmdb_ci_service_discovered\] * Service \[cmdb_ci_service\] |
| userSysId | String | Sys_id of the user record. Located in the User \[sys_user\] table. |
[Table 10. Parameters]

{#BSM-isReadingPermitted_O_S__table_snj_253_kyb} {#BSM-isReadingPermitted_O_S__table_tnj_253_kyb__entry__2}

| Type | Description |
|-|-|
| Boolean | Flag that indicates whether the user has permission to view the specified service/service group. Possible values: * true: User can view the specified service/service group. * false: User can't view the specified service/service group. |
[Table 11. Returns]

{#BSM-isReadingPermitted_O_S__table_tnj_253_kyb}  
The following code example shows how to call this method to check the specified user's ability to access the specified service group.

    var cmdbServGr = new GlideRecord('cmdb_ci_service_discovered');
    cmdbServGr.addQuery('sys_id', "123123123123123123123123");
    cmdbServGr.query();
    var userId = gs.getUserID();

    var bsManager = new SNC.BusinessServiceManager();
    while (cmdbServGr.next()) {
      var answer = bsManager.isReadingPermitted(cmdbServGr, userId);

      //do something with / according to the answer

    }

## BusinessServiceManager - migrateManualToApplicationService(String service_id) {#ariaid-title8}

Converts a manual service to an application service.
{#BSM-migrateManualToITService_S__table_xjk_w41_sdb__entry__3}

| Name | Type | Description |
|-|-|-|
| service_id | String | Sys ID of the manual service to convert. |
[Table 12. Parameters]

{#BSM-migrateManualToITService_S__table_xjk_w41_sdb} {#BSM-migrateManualToITService_S__table_yjk_w41_sdb__entry__2}

| Type | Description |
|-|-|
| Boolean | True if the migration to an application service succeeds. |
[Table 13. Returns]

{#BSM-migrateManualToITService_S__table_yjk_w41_sdb}  

    var bsManager = new SNC.BusinessServiceManager();
    var appService = bsManager.migrateManualToApplicationService("451047c6c0a8016400de0ae6df9b9d76");

## BusinessServiceManager - populateApplicationService(String service_id, Number levels,
String black_listed_relation_types) {#ariaid-title9}

Populates an application service with relations and CIs from the designated entry
point.
{#BSM-populateDiscoveredService_S_N_S__table_crl_yx1_sdb__entry__3}

| Name | Type | Description |
|-|-|-|
| service_id | String | Sys ID of the application service to populate. |
| levels | Number | Number of levels of CIs to add from the CMDB. |
| black_listed_relation_types | String | Relation types to exclude when populating the application service. |
[Table 14. Parameters]

{#BSM-populateDiscoveredService_S_N_S__table_crl_yx1_sdb} {#BSM-populateDiscoveredService_S_N_S__table_drl_yx1_sdb__entry__2}

| Type | Description |
|-|-|
| Boolean | True if the operation is successful. |
[Table 15. Returns]

{#BSM-populateDiscoveredService_S_N_S__table_drl_yx1_sdb}  

    var bsManager = new SNC.BusinessServiceManager();
    var appService = bsManager.populateApplicationService("5bf65ebeedb91300964f6fa662989533", 10, "Depends on::Used by");

## BusinessServiceManager - removeCI(String service_id, String target_id) {#ariaid-title10}

Removes a manually created CI from an application service.
{#BSM-removeManualCi_O_O__table_bcz_py1_sdb__entry__3}

| Name | Type | Description |
|-|-|-|
| service_id | String | Sys ID of the application service to remove a CI from. Note: Passing a GlideRecord object is also supported. |
| target_id | String | Sys ID of the CI to remove from the application service. Note: Passing a GlideRecord object is also supported. |
[Table 16. Parameters]

{#BSM-removeManualCi_O_O__table_bcz_py1_sdb} {#BSM-removeManualCi_O_O__table_ccz_py1_sdb__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 17. Returns]

{#BSM-removeManualCi_O_O__table_ccz_py1_sdb}  

    var bsManager = new SNC.BusinessServiceManager();
    var appService = bsManager.removeCI("2fce42d80a0a0bb4004af34d7e3984c8", "3a290cc60a0a0bb400000bdb386af1cf");

## BusinessServiceManager - removeEntryPoint(serviceId, endpointSysId) {#ariaid-title11}

Removes an existing entry point from the application service.
{#BSM-removeEntryPoint_S_S__table_xj2_n32_zwb__entry__3}

| Name | Type | Description |
|-|-|-|
| serviceId | String | Sys_id of the application service to add the connection to. |
| endpointSysId | String | Sys_id of the entry point endpoint to remove. |
[Table 18. Parameters]

{#BSM-removeEntryPoint_S_S__table_xj2_n32_zwb} {#BSM-removeEntryPoint_S_S__table_yj2_n32_zwb__entry__2}

| Type | Description |
|-|-|
| Boolean | Flag indicating that the entry point was successfully removed from the application service. Possible values: * true: the update was successful. * false: the update was not successful. |
[Table 19. Returns]

{#BSM-removeEntryPoint_S_S__table_yj2_n32_zwb}  
The following example removes the entry point associated with Sys_id "aa65ebeedb91300964f6fa6629895ss" from the given application service.

    var bsManager = new SNC.BusinessServiceManager();
    var serviceId = "5bf65ebeedb91300964f6fa662989533";
    var entrypointId = "aa65ebeedb91300964f6fa6629895ss";
    bsManager.removeEntryPoint(serviceId, entrypointId);

Output:

    true

## BusinessServiceManager - removeManualConnection(String source_id, String endpoint_id,
String service_id) {#ariaid-title12}

Removes a manually created connection and the connected CI from an application
service.
{#BSM-removeManualConnection_S_S_S__table_spm_sbb_sdb__entry__3}

| Name | Type | Description |
|-|-|-|
| source_id | String | Sys ID of the CI connected to the endpoint. |
| endpoint_id | String | Sys ID of the manually created connection to remove from the application service |
| service_id | String | Sys ID of the application service to remove the connection from. |
[Table 20. Parameters]

{#BSM-removeManualConnection_S_S_S__table_spm_sbb_sdb} {#BSM-removeManualConnection_S_S_S__table_tpm_sbb_sdb__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 21. Returns]

{#BSM-removeManualConnection_S_S_S__table_tpm_sbb_sdb}  

    var bsManager = new SNC.BusinessServiceManager();
    var appService = bsManager.removeManualConnection("3a307c930a0a0bb400353965d0b8861f", "60ce3176edb91300964f6fa6629895d1", "2fce42d80a0a0bb4004af34d7e3984c8");

## BusinessServiceManager - updateEntryPoint(serviceId, endpointGr) {#ariaid-title13}

Updates an existing entry point in the application service.
{#BSM-updateEntryPoint_S_O__table_oht_422_zwb__entry__3}

| Name | Type | Description |
|-|-|-|
| serviceId | String | Sys_id of the application service to add the connection to. |
| endpointGr | Object | Glide Record object in the CI Endpoint \[cmdb_ci_endpoint\] table or its child table to add to the application service. |
[Table 22. Parameters]

{#BSM-updateEntryPoint_S_O__table_oht_422_zwb} {#BSM-updateEntryPoint_S_O__table_pht_422_zwb__entry__2}

| Type | Description |
|-|-|
| Boolean | Flag indicating the update was successfully applied to the entry point. Possible values: * true: the update was successful. * false: the update was not successful. {#BSM-updateEntryPoint_S_O__ul_f52_dg2_zwb} |
[Table 23. Returns]

{#BSM-updateEntryPoint_S_O__table_pht_422_zwb}  
The following updateEntryPoint() example shows how to update the connection with a new entry point.

    var now_GR = new GlideRecord("cmdb_ci_endpoint_http");
    now_GR.get("11f65ebeedb91300964f6fa66298951");
    now_GR.setValue("protocol", "https");
    var bsManager = new SNC.BusinessServiceManager();
    var serviceId = "5bf65ebeedb91300964f6fa662989533";
    bsManager.updateEntryPoint(serviceId,now_GR);

Output:

    true


