Channel should automatically populate in incident form for Itil users

Suresh KSB
Giga Expert

Channel field should automatically populate with 'Self Service' if an Itil user raised an incident using the Self-Service portal.
If an Itil user raise an incident using the ServiceNow tool, Channel field should be automatically filled in with "User."

 

How to achieve this requirement.

1 ACCEPTED SOLUTION

Thank you for reply.

 

Working the below code for me.

 

Table : incident

UI Type : All

Type : onLoad

Script : 

function onLoad() {

var chanVal = g_form.getValue('contact_type');
if (g_user.hasRoleExactly("itil") && chanVal != 'self-service') {

g_form.setValue('contact_type', 'User');

}

}

 

View solution in original post

4 REPLIES 4

Community Alums
Not applicable

@Suresh KSB --

You need to write client script as below : 

Table : incident

UI Type : All

Type : onLoad

Script : 

function onLoad() {
    //Type appropriate comment here, and begin script below
    if (g_user.hasRoleExactly('itil')) // Checking current logged in user has role itil or not
    {
        g_form.setValue('contact_type''self-service'); // Set channel as self service
}
    }

Thanks for your reply.

 

Working the below code for me.

 

Table : incident

UI Type : All

Type : onLoad

Script : 

function onLoad() {

var chanVal = g_form.getValue('contact_type');
if (g_user.hasRoleExactly("itil") && chanVal != 'self-service') {

g_form.setValue('contact_type', 'User');

}

Thank you for reply.

 

Working the below code for me.

 

Table : incident

UI Type : All

Type : onLoad

Script : 

function onLoad() {

var chanVal = g_form.getValue('contact_type');
if (g_user.hasRoleExactly("itil") && chanVal != 'self-service') {

g_form.setValue('contact_type', 'User');

}

}

 

Thank you for reply.

 

Working the below code for me

 

Table : incident

UI Type : All

Type : onLoad

Script : 

function onLoad() {
 

var chanVal = g_form.getValue('contact_type');
if (g_user.hasRoleExactly("itil") && chanVal != 'self-service') {

g_form.setValue('contact_type', 'User');

}