Timecard

ShreyasG
Tera Contributor

I have a requirement in timecard  where i have to define a window and within that window only users should be able to enter time, also will it be possible if the window is ending on tuesday then users should not be able to submit from wednesday to Saturday. I have a business rule which is checking window start date and end date. And then restricting submission 

1 REPLY 1

Matthew_13
Mega Sage

Hi Buddy,

Yes — your approach is correct, and the requirement is fully supported.

  • Use a Before Business Rule on the timecard table.

  • Enforce the rule only on submission (state change to Submitted), not on draft saves.

  • Compare the current date/time to the window end date.

  • If the window ends on Tuesday, the rule will automatically block submissions from Wednesday through Saturday.

Example (simplified):

if (current.state == 'submitted' && previous.state != 'submitted') {
    var now = new GlideDateTime();
    if (now.after(new GlideDateTime(current.u_window_end))) {
        gs.addErrorMessage('Time entry submission window has closed.');
        current.setAbortAction(true);
    }
}

Optionally add a UI Policy to disable the Submit button for better user experience, but keep the Business Rule as the enforcement layer.

 

@ShreyasG - Please mark Accepted Solution and Thumbs Up if you found Helpful