search cancel

How to validate that a Service Desk Manager workshift configuration is correct?

book

Article ID: 36509

calendar_today

Updated On:

Products

CA Service Desk Manager CA Service Management - Service Desk Manager

Issue/Introduction

How to validate that a Service Desk Manager workshift is correctly configured?

Environment

Service Desk Manager 12.x, 14.1 and 17.x

All Supported Operating Systems

Resolution

Follow these steps to create a tool to validate all Service Desk Manager workshifts. 

1.  Open a command prompt on the Service Desk server with 'Run as Administrator' and navigate to the NX_ROOT\bin directory

2.  Create a text file named test.frg

3.  Copy and paste the following content to the test.frg file

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.  Login to Service Desk Manager as an Adminstrator and navigate to ADMINISTRATION->SERVICE DESK->APPLICATION DATA->CODES->WORKSHIFTS to 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: (i.e. 'Regular' or '24 hours')

An example:

There exists a 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 actually come.

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

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

1/1/2022

1/15/2022

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

Run the following command:

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

Workshift

---------

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

1/1/2022

1/15/2022

'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/2022 16:00:00' and '01/14/2022 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 a holiday on Friday, January the 15th and the weekend are considered for the SLA, you run this command:

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

Workshift

---------

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

01/15/2016

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

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

'Duration in seconds: '7200

'Duration in minutes: '120'

'Duration in hours: '2.000000'

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

Additional Information

Workshift Setup - https://techdocs.broadcom.com/us/en/ca-enterprise-software/business-management/ca-service-management/17-3/administering/configure-ca-service-desk-manager/establishing-support-structure/setting-up-your-ca-sdm-system/define-code-for-application-data-components/workshift-setup.html