Auto populate manager name when a assignment group is selected in incident form

Ashwini8
Tera Contributor

Hi All,

There is a requirement that when we select a perticular assignment group the group manager name should populate in manager field. I have created a manager field. Please suggest me how to autopopulate the name when group is selected.

Regards,

Tejaswini

1 ACCEPTED SOLUTION

Akshata jamdar
Mega Guru

Hello Tejaswini,

You can also create a BR for before insert, update 

Condition:

find_real_file.png

 

find_real_file.png

 

 

Hope this will help you.

Kindly mark an answer as correct and helpful if it will resolve your query.

Regards,

Akshata

 

 

View solution in original post

6 REPLIES 6

Willem
Giga Sage
Giga Sage

Create a client script onChange of the group field:

(update the fields accordingly if you have other fields)

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    var group = newValue;
    var ga = new GlideAjax('global.customFormUtil');
    ga.addParam('sysparm_name', 'getManager');
    ga.addParam('sysparm_group', group);
    ga.getXMLAnswer(ajaxResponse);
    function ajaxResponse(answer) {
        var groupObj = JSON.parse(answer);
        g_form.setValue('u_manager', groupObj.manager);
    }
}

 

And a Client callable script include:

var customFormUtil = Class.create();
customFormUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    getManager: function () {
        var groupObj = {};
        var group = this.getParameter('sysparm_group');
        var grGroup = new GlideRecord('sys_user_group');
        if (grGroup.get(group)) {
            groupObj.manager = grGroup.getValue('manager');//
        }
        var userJson = global.JSON.stringify(groupObj);
        return userJson;
    },

    type: 'customFormUtil'
});

Akshata jamdar
Mega Guru

Hello Tejaswini,

You can also create a BR for before insert, update 

Condition:

find_real_file.png

 

find_real_file.png

 

 

Hope this will help you.

Kindly mark an answer as correct and helpful if it will resolve your query.

Regards,

Akshata

 

 

Hi Akshata,

We want it to restict only to a perticular assignment group = major incident group. Only if we select this group the manager field should populate with manager name for other groups it should be empty. Can you please suggest

You need to add one if condition under

if(gr.next())

{

if(ass_group=="sys_id of major incident group")

{

//remaining code will be same

}

}

 

Regards,

Akshata