How to extract the list of Application services for a business application?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 11:30 PM
Dear All,
Greetings !!!
I have a requirement to extract a list of Application Services for a particular Business Application. I do not want to view that list in the Related Items section of the Application Service but I want this list by extracting the same using a script. Is there a way I can extract it by doing a GlideRecord for a particular Business Application?
Any help will be highly appreciated.
Thanks & Regards,
Gulzar Manuja
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 11:48 PM
Hi @Gulzar Manuja2 ,
If the relation between Application Service and Business Application is directly, then you do not need any script. You can instead just create a report on the cmdb_rel_ci table.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 11:56 PM
Hi @Gulzar Manuja2 ,
Role required: sm_admin or sm_user
- Servers that host applications.
- Network devices like routers or switches.
- Processes running on hosting servers. Processes are used for identification and classification of applications.
- Tracked configuration files for applications that are part of the service.
- Endpoints belonging to the applications. Endpoints contain information necessary for connecting to applications, like hosts and ports.
- The application service CI for this application service.
The CI lists for empty application services, that do not contain any CIs contain only one CI: For the application service itself.
Procedure
- Navigate to All > CSDM > Manage Technical Services > Application Service.
- Click the name of the application service for which you want to view the list of CIs.
The discovery state of the selected service must be Done.
- Click List CIs under Related Items.
- View the complete list of CIs that are part of the selected application service.
- When you are done reviewing the list of CIs, perform one of the following actions:
To navigate to the application service map, click View Map.
Alternatively, click the Back button next to the service name at the top of the window.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2023 04:46 AM
Creating a report using 'cmdb_rel_ci' is a sureshot way to get the list of all direct relationships between Business Applications and Application Services as @AndersBGS mentioned.
From Tokyo release onwards, the new 'CMDB intelligent feature' also looks like a possible way to get this done in a more convenient manner.
This can be accessed from the CMDB workspace. The documentation is given below.
You might have to play around with the search keywords (E.g. Show Business Applications consuming Application Services) as well as what is configured in the 'CMDB Implicit Relationships' table to get the intended result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2023 08:54 AM - edited 04-21-2023 08:55 AM
Hi @Gulzar Manuja2 ,
You can get this information in several ways depending on what you really want to achieve. I suppose you need to work with script, for some reason, so I will start in 1) with the simple, straightforward scripting solution and then in 2) provide you also more powerful technique:
1) Straightforward solution when you use the relationship Consumes::Consumed by recommended by CSDM between Business Application and Application Service and info directly from cmdb_rel_ci table (as already mentioned by AndersBGS)
// Put here the Sys ID of your Business Application for which you're searching Application Services
var businessAppID = "3e7c107d974921101854f9271153afc2";
// Result array of Sys IDs of Application Services
var appServicesIDs = [];
var ciRelGR = new GlideRecord("cmdb_rel_ci");
// Identification of your Business Application
ciRelGR.addQuery("parent", businessAppID);
// Child CI must be an Application Service
ciRelGR.addQuery("child.sys_class_name", "cmdb_ci_service_auto");
// Identify the relationship type
ciRelGR.addQuery("type.parent_descriptor", "Consumes");
ciRelGR.addQuery("type.child_descriptor", "Consumed by");
ciRelGR.query();
while(ciRelGR.next()) {
// Add Sys ID of the child Applicatyion Service into the result array
appServicesIDs.push(ciRelGR.getValue("child"));
}
// Show results (Sys IDs of Application Services connected with your Business Applciation)
gs.info(appServicesIDs);
You can update the scrip appropriately to serve your exact needs.
2) Technique combining power of CMDB Query Builder and scripting with CMDBQueryBuilderAPI
The connection between your Business Applications and Application Services may be more complicated. For instance, there might be a SDLC Component CI in between (now we are not discussing how clear this is in terms of the CSDM, the example is just for an illustration).
The dependency view can look like this:
In this case, you can leverage the power of CMDB Query Builder to find Business Applications connected to Application Services via SDLC Components. Let's assume your query will be named "BA to AS", and it will look like this:
Then you can easily use this defined CMDB query in your scrip to receive desired results, like this:
// Put here the Sys ID of your Business Application for which you're searching Application Services
var businessAppID = "1a449952979621101854f9271153af1e";
// Name of your prepared CMDB Query
var queryName = "BA to AS";
// Use CMDBQueryBuilderAPI to obtain name of the table where your CMDB query results are stored
// true parameter means that the CMDB query will be freshly run
var resultStr = SNC.CMDBQueryBuilderAPI.getSavedQueryExecutionDetails("BA to AS", true);
var resultObj = JSON.parse(resultStr);
var queryResultsTable = resultObj.table_name;
var queryID = resultObj.query_id;
// Let's check what we are working with
gs.info("queryResultsTable: " + queryResultsTable);
gs.info("queryID: " + queryID);
// Result array of Sys IDs of Application Services
var appServicesIDs = [];
var queryResultGR = new GlideRecord(queryResultsTable);
// Identification of your Business Application
// btw: u_business_application_1 is how the Query Builder called the column
queryResultGR.addQuery("u_business_application_1", businessAppID);
queryResultGR.addQuery("query", queryID);
queryResultGR.query();
while(queryResultGR.next()) {
// Add Sys ID of the Application Service into the result array
appServicesIDs.push(queryResultGR.getValue("u_application_service_1"));
}
// Show results - Sys Ids of all Application Services connected with your Business Applciation
gs.info(appServicesIDs);
Imagine the flexibility this combined solution provides! You can have as complex CMDB Query defined as needed and you still can achieve your desired results with a simple script.
I hope these scripts will help you.
Regards,
Jan