BusinessServiceManager - Global

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 21분
  • 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()

    Instantiates a BusinessServiceManager object.

    표 1. Parameters
    Name Type Description
    None
    var bsManager = new SNC.BusinessServiceManager();

    BusinessServiceManager - addCI(String service_id, String source_id, String target_id)

    Adds a CI to a manually-created application service.

    표 2. Parameters
    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.
    표 3. Returns
    Type Description
    void
    //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

    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.
    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)

    Adds an entry point to the application service and starts discovery on the entry point.

    표 4. Parameters
    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.
    표 5. Returns
    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.

    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)

    Adds a new entry point without starting discovery.

    표 6. Parameters
    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.
    표 7. Returns
    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.

    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)

    Adds a manually created connection to an application service.

    표 8. Parameters
    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.
    표 9. Returns
    Type Description
    void
    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)

    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.
    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. If any of them returns true, return true.
    표 10. Parameters
    Name Type Description
    gr GlideRecord GlideRecord of the service/service group. This GlideRecord can be from one of the following tables:
    • Service Instance [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.

    Table: User [sys_user]

    표 11. Returns
    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.

    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)

    Converts a manual service to an application service.

    표 12. Parameters
    Name Type Description
    service_id String Sys ID of the manual service to convert.
    표 13. Returns
    Type Description
    Boolean True if the migration to an application service succeeds.
    var bsManager = new SNC.BusinessServiceManager();
    var appService = bsManager.migrateManualToApplicationService("451047c6c0a8016400de0ae6df9b9d76");

    BusinessServiceManager - populateApplicationService(String service_id, Number levels, String black_listed_relation_types)

    Populates an application service with relations and CIs from the designated entry point.

    표 14. Parameters
    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.
    표 15. Returns
    Type Description
    Boolean True if the operation is successful.
    var bsManager = new SNC.BusinessServiceManager();
    var appService = bsManager.populateApplicationService("5bf65ebeedb91300964f6fa662989533", 10, "Depends on::Used by");

    BusinessServiceManager - removeCI(String service_id, String target_id)

    Removes a manually created CI from an application service.

    표 16. Parameters
    Name Type Description
    service_id String

    Sys ID of the application service to remove a CI from.

    주:
    Passing a GlideRecord object is also supported.
    target_id String

    Sys ID of the CI to remove from the application service.

    주:
    Passing a GlideRecord object is also supported.
    표 17. Returns
    Type Description
    void
    var bsManager = new SNC.BusinessServiceManager();
    var appService = bsManager.removeCI("2fce42d80a0a0bb4004af34d7e3984c8", "3a290cc60a0a0bb400000bdb386af1cf");

    BusinessServiceManager - removeEntryPoint(serviceId, endpointSysId)

    Removes an existing entry point from the application service.

    표 18. Parameters
    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.
    표 19. Returns
    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.

    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)

    Removes a manually created connection and the connected CI from an application service.

    표 20. Parameters
    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.
    표 21. Returns
    Type Description
    void
    var bsManager = new SNC.BusinessServiceManager();
    var appService = bsManager.removeManualConnection("3a307c930a0a0bb400353965d0b8861f", "60ce3176edb91300964f6fa6629895d1", "2fce42d80a0a0bb4004af34d7e3984c8");

    BusinessServiceManager - updateEntryPoint(serviceId, endpointGr)

    Updates an existing entry point in the application service.

    표 22. Parameters
    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.
    표 23. Returns
    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.

    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