How to validate that a workshift is correct?

book

Article ID: 36509

calendar_today

Updated On:

Products

SUPPORT AUTOMATION- SERVER CA Service Desk Manager - Unified Self Service KNOWLEDGE TOOLS CA Service Management - Asset Portfolio Management CA Service Management - Service Desk Manager

Issue/Introduction

Question:

How to validate that a workshift is correctly configured?

 

Environment:  

CA Service Desk Manager, any version.

 

Answer: 

 

Follow these steps to create a tool to validate all workshifts. 

 

1- Open a command prompt at the Service Desk server. 

2- Create a text file named test.frg

3- Copy and paste this content to test.frg 

string check_workshift(...) 

{

   int tmpDuration;

   string wrkshft_schedule;

   float hours;

   date start_date;

   date start_end;

   string sym_wrk;

   string errmsg;

 

        if(argc!=3) {

                errmsg=format("Incorrect nyumber of parameters specified");

                errmsg += "\n\nUsage: \tbop_cmd -d domsrvr -f test.frg \"check_workshift(";

                errmsg += " 'Start Date', ";

                errmsg += " 'End Date', ";

                errmsg += " 'Workshift Name (sym)' ";

                errmsg += ")\n\n";

                errmsg += "\tNota: Dates should have the format MM/DD/YYYY HH:MM:SS \n";

                printf(errmsg);

                return;

        }

start_date=argv[0];

end_date=argv[1];

sym_wrk=argv[2];

wrkshft_schedule = (string)expand(format("&{'%s' = wrkshft.sym->sched}",sym_wrk));

          if(msg_error()) 

         {

           printf("Error %d\n", msg_error());

           return;

         }

printf(" \n");

printf("Workshift\n");

printf("---------\n");

printf("'%s\n'", wrkshft_schedule);

printf(" \n");

printf(" \n");

tmpDuration = (int)workshift_abs2work(wrkshft_schedule, start_date, end_date);

printf("Start : '%s\n'", start_date);

printf("End : '%s\n'", end_date);

printf("Duration in seconds: '%d\n'", (int) tmpDuration);

hours=tmpDuration/3600;

minutes=tmpDuration/60;

printf("Duration in minutes: '%d'", minutes);

printf(" \n");

printf("Duration in hours: '%f'", hours);

printf(" \n");

}

 

4. Save the file.

5. Determine the name of the workshift you need to validate.

6. From the command prompt run this command:

   bop_cmd -f test.frg "check_workshift(Start Date, End Date, Workshift Name)"

   where the arguments are:

    Start Date: when the event started (format MM/DD/YYYY HH:MM:SS)

    End Date: end of the time frame to check (format MM/DD/YYYY HH:MM:SS)

    Workshift Name : e.g. 'Regular' or '24 hours'

 

An example:

 

You have created this workshift named 'Test Workshift' and need to know if dates entered as holidays and the times defined are properly used to calculate SLAs without having to wait for that day to come or adding dummy dates.

This is the definition of the workshift named 'Test Workshift'

 

Mon - Fri { 8:00 am - 5:00 pm }

1/1/2016

1/15/2016

Let's assume that you need to know if a ticket created today, Wednesday January the 13th at 4 pm, will be properly get an SLA of 2 hours expiring tomorrow at 9 am. 

 

 C:\PROGRA~1\CA\SERVIC~1>bop_cmd -f test.frg "check_workshift('01/13/2016 16:00:00', '01/14/2016 09:00:00','Test Workshift')"

 

Workshift

---------

'Mon - Fri { 8:00 am - 5:00 pm }

1/1/2016

1/15/2016

'

 

Start : '01/13/2016 16:00:00

'End : '01/14/2016 09:00:00

'Duration in seconds: '7200

'Duration in minutes: '120'

Duration in hours: '2.000000'

 

This means that based on that particular workshift there are 2 available hours between '01/13/2016 16:00:00' and '01/14/2016 09:00:00' which is expected. 

 

Following the same example, if you want to make sure that a ticket created on Thursday January the 14th at 4 pm and the holiday on Friday January the 15th and the weekend are considered you run this command:

 

C:\PROGRA~1\CA\SERVIC~1>bop_cmd -f test.frg "check_workshift('01/14/2016 16:00:00', '01/18/2016 09:00:00','Test Workshift')"

 

Workshift

---------

'Mon - Fri { 8:00 am - 5:00 pm }

01/15/2016

 

'

 

Start : '01/14/2016 16:00:00

'End : '01/18/2016 09:00:00

'Duration in seconds: '7200

'Duration in minutes: '120'

Duration in hours: '2.000000'

 

As expected, only 2 hours are consumed by the SLA using that particular workshift.

 

 

 

 

 


Environment

Release: SDMU0M99000-14.1-Service Desk Manager-Full License
Component: