create application-server relationship

brahmandlapally
Giga Guru

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.

4 ACCEPTED SOLUTIONS

Anantha27
Mega Guru

Hi @brahmandlapally 

 

To populate the 'Hosted Application' field and create a 'Runs on' relationship for a new server in ServiceNow:

  1. Create a Business Rule on the cmdb_ci_server table.
  2. 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

View solution in original post

VishaalRanS
Tera Guru

Hi @brahmandlapally 

 

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.

View solution in original post

Sai Krishna6147
Mega Guru

Hi @brahmandlapally 

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:

  1. 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.
  2. 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.
  1. 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.

 

View solution in original post

Ramesh_143
Giga Guru

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.

 

 

 

 

View solution in original post

11 REPLIES 11

Saurabh Gupta
Kilo Patron

What is the process of new server is provisioning? 


Thanks and Regards,

Saurabh Gupta

end user will request new server built request through catalog item form one of field in form should get populated in new server CI record 

 

Hi,
How a newly created server linked to the RITM/related task created from the catalog?

 

 


Thanks and Regards,

Saurabh Gupta

So you want , as soon as the Server CI get created and user selects Application and click on submit, the relationship get created?

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************