Apply Minimum 40 hours to time sheet portal

maneesh3
Tera Contributor

Hi Team,

 

How to apply minimum hours to be filled by user to 40 in time sheet portal. I have verified time sheet properties but I saw only Maximum hours property. Help me here how to achieve minimum hours rule to be applied while clicking on Submit button validation has to happen.

 

Thanks for support

6 REPLIES 6

Runjay Patel
Giga Sage

Hi @maneesh3 ,

 

You can write before insert/update BR with below.

if (current.total_hours < 40) { 
        gs.addErrorMessage("A minimum of 40 hours is required to submit the timesheet.");
        current.setAbortAction(true); 
    }

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Hi Runjay,

 

Thanks for your help! Code is not working.  Code needed for all time card entries for a week to be minimum 40 hours.  Please suggest

 

Thanks,