Scripted way to set relation between Application service - BA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2022 02:40 AM
Hi
I am currently working on a greenfield deployment of CSDM. What I observed is I can not define an Application/Technical service without mapping technical and business service offerings. Our stakeholders are yet to come back with their respective offerings and customer is expecting to see Business Applications are mapped with the applications as proof of value initiation. There are around 450 applications which need to be covered using CSDM.
Is there any scripted way to skip mapping the offerings and set up the relationships between technical/application services with Business Application? I tried to write the following lines in the main script for the same, but it did not help. Any help will be much appreciated.
//Creates an application service with the same name of the application
var appSvc = new GlideRecord('cmdb_ci_service_auto');
appSvc.initialize();
appSvc.name = appName; //Say appName is fed by an array of application names here.
appSvc.service_classification = "Application Service";
var appSvcSysID = appSvc.insert(); //Collects the sys_id of the newly created Application Service.
// Creates the relationships between different entries.
var relation = new GlideRecord('cmdb_rel_ci');
//Creates new relationship between new Business Application and new Application Service
relation.initialize();
relation.parent = newBAsysID;
relation.child = appSvcSysID;
relation.type.setDisplayValue("Consumes::Consumed by");
relation.insert();
//Creates new relationship between new Application Service and new Application.
relation.initialize();
relation.parent = appSvcSysID;
relation.child = applicationSysID;
relation.type.setDisplayValue("Depends on::Used by");
relation.insert();
- Labels:
-
Multiple Versions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2022 08:46 AM
I would add some changes:
//Creates an application service with the same name of the application
var appSvc = new GlideRecord('cmdb_ci_service_auto');
appSvc.initialize();
appSvc.name = appName + 'Production'; //Say appName is fed by an array of application names here.
appSvc.service_classification = "Application Service";
var appSvcSysID = appSvc.insert(); //Collects the sys_id of the newly created Application Service.
if there is a risk in duplicate names. If I am correct it validates if the name exist.
BR,
Barry