auto populate Employee Title, Employee Email ,Employee User ID, Employee Department

Purushotham9963
Tera Contributor

Hi , 

 

 

If I select employee name in service portal , how can we auto populate  Employee Title,   Employee Email,  Employee User ID,   Employee Department, Employee Manager,    Manager Email

 

 

Thanks in advance 

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Purushotham9963 

 

In SN , it is OOTB available. 

 

LearnNGrowAtul_0-1704379967462.png

 

Create these variable and#

use Auto populate where depend on question 1 for all, and do the dot walk. 

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

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

May I know what is dot walk and how can i fill below 3 columns if select employee name in service portal , how can we auto populate  Employee Title

 

Purushotham9963_0-1704388178244.png

 

Hi @Purushotham9963 

 

Dot walk to 

 

 Employee Email,  Employee User ID,   Employee Department, Employee Manager,    Manager Email

 

LearnNGrowAtul_0-1704460827155.png

 

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

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

HI 

 

i wrote catalog client script(onChange) instead of dot walk , but it is populating user Email only 

 

 

function onChange(control, oldValue, newValue, isLoading) {
    if (newValue == '') {
        g_form.setReadOnly('employee_manager_email', false);
        g_form.clearValue('employee_manager_email');
        g_form.setReadOnly('employee_manager_email', true);
        return;
    }

    g_form.setReadOnly('employee_manager_email', false);
    g_form.clearValue('employee_manager_email');

    var ga = new GlideAjax('global.userDataPopulation'); //This argument should be the exact name of the script include.
    ga.addParam('sysparm_name', 'userEmailAddress'); //sysparm_name is the name of the function in the script include to call. (Change)
    ga.addParam('sysparm_client_requested_for', newValue); //This is an optional parameter which we can reference in the script include.
    ga.getXML(myCallBack); //This is our callback function, which will process the response.

    function myCallBack(response) { //the argument 'response' is automatically provided when the callback funciton is called by the system.
        //Dig out the 'answer' attribute, which is what our function returns.
        var server_result = response.responseXML.documentElement.getAttribute('answer');

        if (server_result != false) {
            g_form.setValue('employee_manager_email', server_result);
            g_form.setReadOnly('employee_manager_email', true);
        }
    }
}

 

 

Thanks in advance