Users can create an Incident on behalf of other users from the same department.

Akash Bhardhwa1
Tera Contributor

A user can create an incident for him/her self by default.

Also a user can create an incident for other users of the same department.

When a user creating an incident for other users, he/she could able to select users from the same department on the "Caller" field.

I know this is complete,

When I can see the looged in user's name in the 'Caller' field when a new incident form is opened.

The logged in user should able to select a different user from the same department only.

3 REPLIES 3

Shakeel Shaik
Giga Sage
Giga Sage

Hi @Akash Bhardhwaj ,

 

then update caller's reference qualifier.

find_real_file.png

 

 

javascript:'department='+gs.getUser().getDepartmentID();

 

If my response is helpful to you, please mark as Correct Answer/Helpful

Please check and let us know.

Thanks 🙂

Thanks,
Shakeel Shaik 🙂

Hi @Akash Bhardhwaj 

 

If my response is helpful to you, please mark as Correct Answer/Helpful

Please check and let us know.

Thanks 🙂

Thanks,
Shakeel Shaik 🙂

Subrahmanyam2
Giga Guru

Hi Akash,

Use Advanced reference qualifier and invoke a script include function which returns the necessary qualifier.
Please take below steps:

1) Configure dictionary for "Caller" field, and make sure that in the "Reference Specification" tab you set the "Use reference qualifier" field to "Advanced" and "Reference qual" field to "javascript:new IncidentFieldQualifiers().getCallerRefQualifier();" without quotes.

2) Create a script include as shown below 

var IncidentFieldQualifiers = Class.create();
IncidentFieldQualifiers.prototype = {
    initialize: function() {},
    getCallerRefQualifier: function() {
        if(gs.hasRole("service_desk")) return "";
        var department = "";
        var gUsr = new GlideRecord("sys_user");
        gUsr.addQuery("sys_id", gs.getUserID());
        gUsr.query();
        if (gUsr.next()) {
            department = gUsr.getValue("department");
        }
        return "department=" + department;
    },
    type: 'IncidentFieldQualifiers'
};

 

It may be good idea to exclude admin (gs.hasRole("any_role") by default returns true for admins ) and service desk folks from this as you want service desk to create incidents for people from different departments.

If you have additional qualifiers present in your prod, you may want to tweak this and make sure that your current conditions are also included before returning encoded query.

 

Thanks and regards,

Subrahmanyam Satti