Javascript not functioning properly

book

Article ID: 192989

calendar_today

Updated On:

Products

CA Workload Automation DE - Business Agents (dSeries) CA Workload Automation DE DSERIES- SERVER CA Workload Automation DE - System Agent (dSeries) CA Workload Automation DE - Scheduler (dSeries)

Issue/Introduction

The below Javascript is setup for one of our jobs but after simulating for various dates it is not working.  Only for June 10th does the job PSHRSTRT has a delay of 17:05.  For the other dates (May 22, June 11, June 12)  the delay time is 22.05.  Based on the script it should resolve to 17.05.

genTime('LWDM','last workday of month');
if(APPL._SDATE == ONCYCCONFIRMDATE || APPL._SDATE ==ONCYCPLUSDATE || APPL._SDATE ==LWDMDATE || APPL._SDATE =='22 MAY 2020' || APPL._SDATE =='10 JUN 2020' || APPL._SDATE =='11 JUN 2020' || APPL._SDATE =='12 JUN 2020')
PSHRSTRT_tme='17:05'
else
PSHRSTRT_tme='22:05'

Environment

Release : 11.3.x, 12.x

Component : CA WORKLOAD AUTOMATION DE (DSERIES)

Resolution

The APPL._SDATE variable will resolve to the full date like 'Friday 12th Jun 2020' and it's case sensitive.

So, make sure you are using the full date format with the APPL._SDATE variable like below;

genTime('LWDM','last workday of month');
if(APPL._SDATE == ONCYCCONFIRMDATE || APPL._SDATE ==ONCYCPLUSDATE || APPL._SDATE ==LWDMDATE || APPL._SDATE =='Friday 22nd May 2020' || APPL._SDATE =='Wednesday 10th Jun 2020' || APPL._SDATE =='Thursday 11th Jun 2020' || APPL._SDATE =='Friday 12th Jun 2020')
PSHRSTRT_tme='17:05'
else
PSHRSTRT_tme='22:05';