Date and Time Method Examples

var firstDay = current.u_hire_date.getDisplayValue();

var lastDay = current.u_last_date.getDisplayValue();

// If firstDay and lastDay both have values, check to ensure lastDay isn't before firstDay

if(firstDay && lastDay){

if(gs.dateDiff(firstDay, lastDay, true) < 0){

  gs.addErrorMessage\("The last day worked must be after the hire date"\);

  current.u\_last\_date = "";

  current.setAbortAction\(true\);

}

}

DESCRIPTION

This example was prepared using GlideSystem methods in a Business Rule on the User [sys_user] table.

When passed a date field as an argument, the getDisplayValue() method returns the date and time in the user's time zone rather than in GMT.

results matching ""

    No results matching ""