Highlighted
Absent Member.
Absent Member.
12147 views

Ticket assignment rules for operators in assignment groups

Hi all, 


We have requirement to assign tickets to operator in assignment groups based on conditions. 


For ex: In assignment group--network if there are four operators a,b,c and d and then how to assign tickets equally among them based their ticket load(Number tickets each operator is handling).

0 Likes
28 Replies
Highlighted
Absent Member.
Absent Member.

hi all,

 

please provide your valuable suggestion on this.

0 Likes
Highlighted
Contributor.
Contributor.

Hi Abhijit,

 

Were did I check this code. I mean how to use this code. I add this code in FC(probsummary) but I does not find any output.....Please suggest me what should I do for it...

 

Thanks.

Anil

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Hi Anil,

 

I dont remember exactly but i think i added this script in script library.

 

But it should work from FC too. Did you try to run by putting another assignment group instead of hardware..

 

 

regards,

Abhijit K

0 Likes
Highlighted
Contributor.
Contributor.

Hi Abhijit,

 

i added by both (FC and Script library) way and change assignment group as per our requriment but I doesn't get any result. Please describe how to you added this Script in your environment.

 

regards,

Anil

0 Likes
Highlighted
Established Member..
Established Member..

Hi Abhijit,

 

I am curious to know more on this, i tried the script which will print the tickets assigneed to operator of a particular assignment group , so we can see but the auto assignment cant happen ....

 

Is it possible to get the count of tickets open for each assignee in a ticket , thats the count value can it be assigned to a field .

 

Regards

Praveen

--
Say " Cheers! " by clicking Kudos Star on the left .
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Hi abhijit,

 

This code didn't work for me. Copied the code into the Format Control : Probsummary> Javascript.

 

Seems like its not working.

 

Thanks,

Sanjeev

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Ok, while I agree with the others that a manual process is probaby best, even from an ITIL standpoint, and that auto-assigning to a person probably isn't the BEST way to go (what if a person has fewer tickets, but the tickets they get are the harder ones? What happens when a person is on vacation? etc). In our organization, for the groups I am in, it's first come, first serve, and end-of-month reports show who has successfully closed the most tickets.

 

However, that being said, I like building interesting code.

 

There's a couple parts to this. The first part is the dbdict for the ticket counts. Add a dbdict like the following:

Name: operatorWorkload
Field Name: id
Type: character
Sql Name: ID
Sql Type: VARCHAR(60)
Sql Table Alias: m1

 

Field Name: assignment
Type: character
Sql Name: ASSIGNMENT
Sql Type: VARCHAR(60)
Sql Table Alias: m1

 

Field Name: operator
Type: character
Sql Name: OPERATOR
Sql Type: VARCHAR(60)
Sql Table Alias: m1

 

Field Name: autoAssign
Type: logical
Sql Name: AUTOASSIGN
Sql Type: CHAR(1)
Sql Table Alias: m1

 

Field Name: ticketCount
Type: number
Sql Name: TICKETCOUNT
Sql Type: FLOAT
Sql Table Alias: m1


Make ID be the unique key.

 

Next, create a number record:

Class: operatorWorkload

Last Number: 0

Increment By: 1

 

Create a form and formatctrl for the new table. Make the ID and ticketCount fields read only. Formatctrl should have a Before Add subroutine to populate the id.

 

Add the attached script to your ScriptLibrary. This is what does the majority of the work.

 

On the probsummary formatctrl add the following:

Add: true

Update: not same(assignment in $file, assignment in $file0)

Calculation: assignee.name in $file=jscall("operatorWorkload.getLowest", assignment in $file)

 

This FC calls the script, gets the lowest operator, and populates that into the assignee.name on this record.

 

Add: not null(assignee.name in $file)

Update: flag in $file=true and not same(nullsub(assignee.name in $file,"XXX"), nullsub(assignee.name in $file0,"XXX"))

Calculation: $L.void=jscall("operatorWorkload.increaseCount", assignment in $file, nullsub(assignee.name in $file, "XXX"));$L.void=jscall("operatorWorkload.decreaseCount", assignment in $file0, nullsub(assignee.name in $file0, "XXX"))

 

This FC calls the script and increases the count for the current assignee and decreases the count for the previous assignee

 

Update: flag in $file=false and flag in $file0=true and not null(assignee.name in $file)

Calculation: $L.void=jscall("operatorWorkload.decreaseCount", assignment in $file, assignee.name in $file)

 

This FC calls the script and decreases the count when the IM closes.

 

 

Now, it isn't perfect. I'd recommend adding a validation to make sure the operator in the operatorWorkload acutally belongs to the assignment group, and do some post-update triggers on the assignment table to automatically delete the operatorWorkload record if an operator moves to a different team, but that's up to you. Here's the basics, and you should be able to go from here.

Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

@Sanjeev

 

It works in SL and FC also.

YOu need to modify script as per your need I have just hardcoded the values here.

 

Overall idea behing developing this was to have button just like smart indicator beside assignment group and on click of that it show operators and tickets in popup in table format.

 

@Jacob,

 

Thanks for input and making this Idea more valuable than earlier.

Thanks for your magic touch.

 

 

Regards,

Abhijit K

 

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Hi Sanjeev,

 

What is th error you are getting while calling script?

 

RE,

ABhijit K

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Hi Abhijeet,

 

I will post the error message from the log file. But before that can you please explain where is the "operatorFile.name" defined? Is it defined in another javascript or is it an OOB method?

 

May be I am getting the error, because of not editing the method "operatorFile.name"!

 

Regards,

Sanjeev

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Hi Sanjeev,

 

It is the very first line of my script

 

var operatorFile = new SCFile("operator");
 

....

 

....

 var resultset = operatorFile.doSelect("assignment.groups=\"" + "Hardware" +"\"");

 

Kindly Post your script, I guess you trying something different.

 

Re,

Abhijit k

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Hi abhijit,

 

I have copied and pasted your code in the Format Controller>Probsummary>JavaScript

 

Below is the code:

===============================================================================

var operatorFile = new SCFile("operator");
var incidentFile = new SCFile("probsummary");
var count = 0;
var icount = 0;
var resultset = operatorFile.doSelect("assignment.groups=\"" + "TestGroup" +"\"");
var operatornames = new Array();
var incidentcount = new Array();
var countincident = 0;
 
  if(resultset == RC_SUCCESS){
    //print("Operators are found for this assignment group.");
    do
      {
      //print("The name of opeartors are as follows:" + operatorFile.name);
       operatornames[count] = operatorFile.name;
       count++;
       var incidentresultset = incidentFile.doSelect("assignee.name=\"" + operatorFile.name  +"\"");
       if(incidentresultset == RC_SUCCESS){
          do {
              countincident++;
             } while(incidentFile.getNext() != RC_NO_MORE)
          incidentcount[icount] = countincident;
          countincident = 0;
          icount++;
         }
        else{
             incidentcount[icount] = countincident;
             icount++;
         }
      } while (operatorFile.getNext() != RC_NO_MORE);
  }
 // print(count);
  //print("The name of opeartors are as follows:" + operatornames);
  //print("The number of incidents are as follows:" + incidentcount);
  print("\n \t The list of number of incident per user as follows :\n");
  print("\n \t -----OPERATOR------\t\t\t---NumberofInic---\n");
  for (var i=0;i<operatornames.length;i++){
       print("\n\t\t"+ operatornames[i] + "-------" + incidentcount[i] +"\n");
     }

 

==============================================================================

 

The only change I made is the groupname. And I have also checked that the groups do contain more than 1 operators.

 

Ran the code, but couldnot find any JS related error in the log file, infact there was no error . I am not sure enough that wether the code is being fired.

 

Regards,

Sanjeev

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.