Thursday 27 March 2014

Escript to get Last Day of Month in Siebel

Recently I came across an interesting requirement. In an applet, user has a date field and we need to check whether the date entered by the user is the last day of the month. If not we have to throw a validation. I was eager researching for some vanilla functionality to meet the requirement but I could not find one. Lastly I resorted to scripting. The approach was simple. Firstly from the date entered we will extract the month and year using getmonth() and  getfullyear() functions and for each month we will hard code the last day to 31 or 30 and when month is Feb we will check whether the year is a leap year or not. If its a leap year then last day is 29 else 28. So for every month we will store the last day n a variable and based on the date enter will return the appropriate last day.I have written a BC function the recieves a date as input and returns the last day of that month. The function was called from the BC Prewrite record and the function returned the last day which help me throw the validation. I am attaching the function and hope it helps


1 comment:

  1. in the version 8.1 the method clib.div doesn't work. Can you help?

    ReplyDelete