Symantec IGA

  • 1.  Is it possible to compare two dates in BLTH code?

    Posted Nov 04, 2015 09:01 AM

    Hello Community Members,

     

    We have a requirement where we have to compare two dates (user attributes) in BLTH code.

     

    Is it possible? Also is it possible to fetch current date in BLTH code?

     

    Any help here would be highly appreciated.

     

    Thanks,

    Shashank



  • 2.  Re: Is it possible to compare two dates in BLTH code?

    Posted Nov 04, 2015 08:51 PM

    Hi Shashank,

    I think is possible, using BLTH u can retrieve the user attribute value and compare them.

    Using java function, u can get the current date in BLTH code.

     

    regards,

    William



  • 3.  Re: Is it possible to compare two dates in BLTH code?

    Posted Nov 05, 2015 08:16 AM

    Hi William,

     

    Thanks for your response.

     

    We are able to retrieve the Date fro user attribute, but is it possible to compare them by the date function?

     

    We are using the following code:-

     

    pdate = Packages.java.util;

    pformat = Packages.java.text;

    pdate.Date EED=dateFormat.parse(userEED);

    pdate.Date today=pdate.Calendar.getInstance.getTime();

    if(EED.after(today))

    {

    //do something

    }

     

    But the code above is throwing syntax errors. We think it has something to do with the function that we are using.

     

    Can you suggest a better way of doing it?

     

    Thanks,

    Shashank



  • 4.  Re: Is it possible to compare two dates in BLTH code?

    Broadcom Employee
    Posted Nov 08, 2015 10:23 PM

    Hi Shashank,

     

    Are you writing a java class BLTH or javascipt BLTH?

    Whichever method you choose you need to use BLTH API to get user attributes then you can use standard java methods to compare dates.

    Here is an example to get user attribute using javascript BLTH:

     

    function handleValidation(BlthContext, errorMessage) {


    BlthContext.getUser().getAttribute("date");


    // your logic to compare dates


    }


    Thanks,

    Praveen Jain