Time Cards - Time Sheet Policy

Wolf_k
Giga Contributor

Hi , I was wondering if there might be an option to assign different Time sheet policies to users.

I would like to allow one group to post more than  24 hours max a day and the other group shall be 

limited to 24hrs max per day. 

Thank you for helping me. 

 

 

1件の返信1

Marco0o1
Tera Sage

Hi @Wolf_k ;

 

You can create a business rule with the state changes to "submitted" on Update and add a script like this:

 

var currentUser = gs.getUser(); 

if( currentUser.isMemberOf(­'Group1')){
 if(current.total <= 10){
            gs.addErrorMessage("You need to upload more the 10 Hours");
            current.setAbortAction(true);
} 
if( currentUser.isMemberOf(­'Group2')){
 if(current.total <= 20){
            gs.addErrorMessage("You need to upload more the 20 Hours");
            current.setAbortAction(true);
}

if( currentUser.isMemberOf(­'Group3')){
 if(current.total <= 60){
            gs.addErrorMessage("You need to upload more the 60 Hours");
            current.setAbortAction(true);
}

}

Marco0o1_0-1699041216644.png

 

If you want to check the max per day do something like this:

var currentUser = gs.getUser(); 

if( currentUser.isMemberOf(­'Group1')){
 if(current.sunday > 24){
            gs.addErrorMessage("You put more than 24 hours on Sunday");
            current.setAbortAction(true);
} 
 if(current.monday> 24){
            gs.addErrorMessage("You put more than 24 hours on Monday");
            current.setAbortAction(true);
} 
 if(current.tuesday > 24){
            gs.addErrorMessage("You put more than 24 hours on Tuesday ");
            current.setAbortAction(true);
} 
 if(current.wednesday > 24){
            gs.addErrorMessage("You put more than 24 hours on Wednesday");
            current.setAbortAction(true);
} 
 if(current.thursday > 24){
            gs.addErrorMessage("You put more than 24 hours on Thursday");
            current.setAbortAction(true);
} 
 if(current.friday > 24){
            gs.addErrorMessage("You put more than 24 hours on Friday ");
            current.setAbortAction(true);
} 
 if(current.saturday > 24){
            gs.addErrorMessage("You put more than 24 hours on Saturday");
            current.setAbortAction(true);
} 
}

}

 

Know you have an idea how to check, the good is the error is displayed in you time sheet portal when the user tried to submit.

 

Hope that help You