Please help me in how to solve the below given scenarios

Kongaleti Navee
Tera Contributor

Incident Management:

 

Scenario 1: Set the caller's first name as the short description of the incident when it is created.

 

Scenario 2: Display the first name of the assigned technician in the incident form.

 

Problem Management:

 

Scenario 3: Generate a report showing the first names of users who have reported multiple problems.

 

Scenario 4: Update the first name of the problem manager based on the assignment group.

 

Change Management:

 

Scenario 5: Populate the first name of the change requester in the change request form.

 

Scenario 6: Validate that the first name of the change owner matches a specific pattern before approving the change.

 

Request Management:

 

Scenario 7: Use the first name of the requested for user to populate the requested items in a service catalog request.

 

Scenario 8: Display the first name of the service agent assigned to a request in the request form.

 

Common Scenarios:

 

Scenario 9: Count the number of incidents raised by users with the same first name.

Scenario 10: Calculate the average length of first names for all active incidents.

Scenario 11: Retrieve a list of incidents where the caller's first name starts with a specific letter.

4 REPLIES 4

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

Please share what you've tried and where you have difficulties with.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Keshav72
Tera Contributor

Incident Management:

 

Scenario 1: Set the caller's first name as the short description of the incident when it is created.

 

Write onChange client script on caller field and called script include which is return caller information.

 

If I could help you with your Query then, please hit helpful and  mark as Correct !!

Thank You

 

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Kongaleti Navee 

 

Incident Management:

 

Scenario 1: Set the caller's first name as the short description of the incident when it is created.

Atul: Use the Onsubmit Client script to append caller first name . 

 

Scenario 2: Display the first name of the assigned technician in the incident form.

Atul: Where you want to show? on form in which field

 

Problem Management:

 

Scenario 3: Generate a report showing the first names of users who have reported multiple problems.

Atul: Create a repor t of list type and group by 1st Name 

 

Scenario 4: Update the first name of the problem manager based on the assignment group.

Atul: What is business need?

 

Change Management:

 

Scenario 5: Populate the first name of the change requester in the change request form.

Atul: Same, where you want to make changes?

 

Scenario 6: Validate that the first name of the change owner matches a specific pattern before approving the change.

Atul: Need to write a script.  

 

Request Management:

 

Scenario 7: Use the first name of the requested for user to populate the requested items in a service catalog request.

ATul: Same, where?

 

Scenario 8: Display the first name of the service agent assigned to a request in the request form.

Atul: Same, in which filed?

 

Common Scenarios:

 

Scenario 9: Count the number of incidents raised by users with the same first name.

Atul: Group by user/caller.

Scenario 10: Calculate the average length of first names for all active incidents.

Atul: Use PA 

Scenario 11: Retrieve a list of incidents where the caller's first name starts with a specific letter.

Atul: Try condition Caller. Firstname starts with

 

 

Last , look liek you want community to provide you ready made solution for these. I added a heads up. Please give a try.

*************************************************************************************************************
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]

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

Jagadish Sanadi
Kilo Sage
Incident Management:
 
 
 
Scenario 1: Set the caller's first name as the short description of the incident when it is created.
 
//script Include
getUserFirstName: function() {
        var sysID = this.getParameter('sysparm_firstname');
        var jsUser = new GlideRecord('sys_user');
        jsUser.addQuery('sys_id', sysID);
        jsUser.query();
        while (jsUser.next())
{
            var userDetails = {};
            userDetails.first_name = jsUser.first_name.toString();
//gs.info("userDetails.firstname "+userDetails.firstname);
 
        }
        return JSON.stringify(userDetails);
    }
 
//Client Script
function onLoad() {
    //Type appropriate comment here, and begin script below
    var jsAJAX = new GlideAjax('THGetUserDetails');
    jsAJAX.addParam('sysparm_name', 'getUserFirstName');
    jsAJAX.addParam('sysparm_firstname', g_form.getValue('caller_id'));
    jsAJAX.getXML(response);
 
    function response(response) {
 
 
        var answer = response.responseXML.documentElement.getAttribute("answer");
        var userDetails = JSON.parse(answer);
        g_form.setValue('short_description',userDetails.first_name);
 
    }
 
}
 
 
 
Scenario 2: Display the first name of the assigned technician in the incident form.
 
Script Include:
getTechFirstName : function() {
        var assigned_to = this.getParameter('sysparm_assigned_to');
        var jsUser = new GlideRecord('sys_user');
        jsUser.addQuery('sys_id', assigned_to);
        jsUser.query();
        while (jsUser.next())
{
            var userDetails = {};
            userDetails.first_name = jsUser.first_name.toString();
//gs.info("userDetails.firstname "+userDetails.firstname);
 
        }
        return JSON.stringify(userDetails);
    }
Client Script:
 var jsAJAX1 = new GlideAjax('THGetUserDetails');
        jsAJAX1.addParam('sysparm_name', 'getTechFirstName');
        jsAJAX1.addParam('sysparm_assigned_to', g_form.getValue('assigned_to'));
        jsAJAX1.getXML(response2);
 
        function response2(response) {
 
 
            var answer = response.responseXML.documentElement.getAttribute("answer");
            var userDetails2 = JSON.parse(answer);
            alert(userDetails2.first_name);
 
        }
 
 
Problem Management:
 
 
 
Scenario 3: Generate a report showing the first names of users who have reported multiple problems.
Navigate to reports and add filter same way you apply in list view
 
 
 
Scenario 4: Update the first name of the problem manager based on the assignment group.
Write similar script provided for INC
 
 
 
Change Management:
 
 
 
Scenario 5: Populate the first name of the change requester in the change request form.
Write similar script provided for INC
 
 
 
Scenario 6: Validate that the first name of the change owner matches a specific pattern before approving the change.
Write similar script provided for INC but take change owner value from client script and pass to script include
 
 
 
Request Management:
 
 
 
Scenario 7: Use the first name of the requested for user to populate the requested items in a service catalog request.
 
 
 
Scenario 8: Display the first name of the service agent assigned to a request in the request form.
Write similar script provided for INC
 
 
 
Common Scenarios:
 
 
 
Scenario 9: Count the number of incidents raised by users with the same first name.
(function executeRule(current, previous /*null when async*/) {
 
        // Create an aggregate object  
        var aggIncident = new GlideAggregate('incident');
 
        // Add aggregate  
        aggIncident.addAggregate('COUNT');
 
        // Execute query 
        aggIncident.query();
 
        // Process returned records
        while(aggIncident.next()){
            // Create a message to display the count of the Caller's active Incidents
            var msg = current.caller_id.name + " has " + aggIncident.getAggregate('COUNT') + " active incidents." ;
            gs.addInfoMessage(msg);
        }
 
Scenario 10: Calculate the average length of first names for all active incidents.
Formula incidicators should be used in PA
 
 
Scenario 11: Retrieve a list of incidents where the caller's first name starts with a specific letter.
getTechFirstName : function() {
        var assigned_to = this.getParameter('sysparm_assigned_to');
        var jsUser = new GlideRecord('sys_user');
        jsUser.addQuery('sys_id', assigned_to);
        jsUser.query();
        while (jsUser.next())
{
            var userDetails = {};
            userDetails.first_name = jsUser.first_name.toString();
//gs.info("userDetails.firstname "+userDetails.firstname);
 
        }
        return JSON.stringify(userDetails);
    }
Please mark my answer as helpful and the solution accepted if it serves the purpose.