- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 07:29 AM
When a new server is provisioned, the 'Application' name from the new server request RITM should be populated to the 'Hosted Application' field for the new server CI record in CMDB.
Also, the Application mentioned in the RITM should have 'Runs on' relationship to that new server.
Solved! Go to Solution.
- 2,731 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2024 09:22 AM
To populate the 'Hosted Application' field and create a 'Runs on' relationship for a new server in ServiceNow:
- Create a Business Rule on the cmdb_ci_server table.
- Script Logic:
- Fetch the associated RITM using a custom field (u_ritm).
- Retrieve the Application from the RITM (u_application).
- Set the 'Hosted Application' field with the Application value.
- Create a 'Runs on' relationship between the Application and the new server.
This ensures the application is linked to the server CI and the relationship is automatically established.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2024 09:52 PM
To achieve the desired functionality in ServiceNow, where the 'Application' name from a new server request (RITM) is populated into the 'Hosted Application' field for the new server CI record in the CMDB, as well as establishing a 'Runs on' relationship between the Application and the new server, you can follow these steps:
Steps to Implement
Create a Business Rule:
- Navigate to System Definition > Business Rules.
- Click on New to create a new business rule.
- Set the conditions to trigger this rule when a new server request is created.
- Script to Populate Hosted Application
Configure Application Relationships:
- Ensure that your applications are defined as Configuration Items (CIs) in the CMDB.
- Validate that the 'Runs on' relationship type exists in your system.
Testing:
- After implementing the business rule, test by creating a new server request and verify that:
- The 'Hosted Application' field is correctly populated.
- The 'Runs on' relationship is established between the new server and the application.
Error Handling:
- Consider adding error handling within your script to manage any issues during the creation of records or relationships.
Thanks, and Regards
Vishaal
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2024 04:05 AM
To achieve the automation of populating the 'Hosted Application' field and creating a 'Runs on' relationship between the server and the application in the CMDB when a new server is provisioned, you can implement this process using ServiceNow or similar ITSM tools. Below is an overview of how this can be accomplished, especially if you are using ServiceNow:
Steps:
- Create Business Rules: A Business Rule can be set up to run when a new Server CI is created and link the Application from the RITM to the Hosted Application field in the Server CI record.
- Script to Update 'Hosted Application' Field: Write a script within the business rule that:
- Retrieves the Application from the RITM (Request Item) when a new server is created.
- Updates the Hosted Application field in the Server CI with the retrieved application name.
- Create a 'Runs on' Relationship:
- A separate script can be added to create a CI Relationship (Application to Server), where the application Runs on the newly provisioned server.
Example for Configuration of servicenow:
Step 1: Business Rule to Update the Hosted Application Field
Trigger: After Insert
Table: cmdb_ci_server
Script:
// Assuming RITM holds a reference to the application, you would need the RITM's sys_id or some identifier.
var ritm = current.variables.request_item; // Assuming request item holds the RITM reference
var ritmGR = new GlideRecord('sc_req_item');
if (ritmGR.get(ritm)) {
var application = ritmGR.u_application;
current.u_hosted_application = application;
current.update();
}
Step 2: Create a Relationship Between Application and Server
Trigger: After Insert (can be part of the same business rule)
Script:
var relationship = new GlideRecord('cmdb_rel_ci');
relationship.initialize();
relationship.parent = current.u_hosted_application; // Application CI
relationship.child = current.sys_id; // New Server CI
relationship.type = 'Runs on::Runs'; // Relationship type
relationship.insert();
With this setup, the 'Hosted Application' field in the new Server CI will be automatically populated, and a Runs on relationship will be created between the Application and Server when a new server is provisioned from a RITM request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 11:42 PM
Hi @brahmandlapally ,
To automate the population of the 'Application' name from a new server request (RITM) into the 'Hosted Application' field of the new server CI record in the CMDB, and to establish a 'Runs on' relationship between them, follow these steps:
---> Extract Application Name: Retrieve the 'Application' name from the RITM upon creation.
--->Populate Hosted Application Field: Use the extracted application name to fill in the 'Hosted Application' field in the new server CI record.
--->Establish 'Runs on' Relationship: Create a 'Runs on' relationship linking the application CI to the newly provisioned server CI.
Thanks & Regards,
Ramesh
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2024 04:05 AM
To achieve the automation of populating the 'Hosted Application' field and creating a 'Runs on' relationship between the server and the application in the CMDB when a new server is provisioned, you can implement this process using ServiceNow or similar ITSM tools. Below is an overview of how this can be accomplished, especially if you are using ServiceNow:
Steps:
- Create Business Rules: A Business Rule can be set up to run when a new Server CI is created and link the Application from the RITM to the Hosted Application field in the Server CI record.
- Script to Update 'Hosted Application' Field: Write a script within the business rule that:
- Retrieves the Application from the RITM (Request Item) when a new server is created.
- Updates the Hosted Application field in the Server CI with the retrieved application name.
- Create a 'Runs on' Relationship:
- A separate script can be added to create a CI Relationship (Application to Server), where the application Runs on the newly provisioned server.
Example for Configuration of servicenow:
Step 1: Business Rule to Update the Hosted Application Field
Trigger: After Insert
Table: cmdb_ci_server
Script:
// Assuming RITM holds a reference to the application, you would need the RITM's sys_id or some identifier.
var ritm = current.variables.request_item; // Assuming request item holds the RITM reference
var ritmGR = new GlideRecord('sc_req_item');
if (ritmGR.get(ritm)) {
var application = ritmGR.u_application;
current.u_hosted_application = application;
current.update();
}
Step 2: Create a Relationship Between Application and Server
Trigger: After Insert (can be part of the same business rule)
Script:
var relationship = new GlideRecord('cmdb_rel_ci');
relationship.initialize();
relationship.parent = current.u_hosted_application; // Application CI
relationship.child = current.sys_id; // New Server CI
relationship.type = 'Runs on::Runs'; // Relationship type
relationship.insert();
With this setup, the 'Hosted Application' field in the new Server CI will be automatically populated, and a Runs on relationship will be created between the Application and Server when a new server is provisioned from a RITM request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 11:42 PM
Hi @brahmandlapally ,
To automate the population of the 'Application' name from a new server request (RITM) into the 'Hosted Application' field of the new server CI record in the CMDB, and to establish a 'Runs on' relationship between them, follow these steps:
---> Extract Application Name: Retrieve the 'Application' name from the RITM upon creation.
--->Populate Hosted Application Field: Use the extracted application name to fill in the 'Hosted Application' field in the new server CI record.
--->Establish 'Runs on' Relationship: Create a 'Runs on' relationship linking the application CI to the newly provisioned server CI.
Thanks & Regards,
Ramesh
Please mark this response as correct or helpful if it assisted you with your question.