- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 01:18 AM
Hii,We had a requirement to lock the time cards for previous week after certain day in the current week.For ex previous week time card can't be submitted by the user after wednesday of current week.
We implemented that using business rule and it is working as expected.But we are confuse on one part if suppose user forgets to fill timecard of previous how will he able to fill that after demanding access from timecard_admin so how to implement that like we can't deactivate br for every user how can we implement that please help us...?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 04:46 AM
Hello
You just need to create a field of true/false type on time_card table. In dictionary set the default value to false.
In your BR condition just check like below. In my case field name is different
YOUR BR CODE WILL BE AS IT IS.
Please mark my respsone as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 03:39 AM
Hello Burhan,
To implement this solution you can create a new field of type checkbox named as for example Allow submission and if the user has not submitted the timesheet for previous than they can check with someone say timecard_admin. so timecard_admin user can check the Allow submission checkbox and in the BR you can check that if Allow submission is checked for any record then the BR should not run.
So for the records where timecard_admin will check that checkbox the BR will not run and the users will be able to submit the timecard for that particular record.
Please mark my respsone as helpful/correct, if it answer your question.
Thank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 03:50 AM
Hii
(function executeRule(current, previous /*null when async*/ ) { var weekStartDate = current.getValue("week_starts_on"); var validDate = new GlideDateTime(weekStartDate);
validDate.addDays(+2); var currentTimeGDT = new GlideDateTime();
currentTimeGDT.addDays(-7); var dur = new GlideDuration();
dur = GlideDateTime.subtract(currentTimeGDT, validDate);
var days = dur.getDayPart(); if (parseInt(days) <= 0) {
if (days == 0) {
var currentTimeGDT1 = new GlideDateTime(); var NowTime = currentTimeGDT1.getDisplayValue();
var NowTimeGDT = new GlideDateTime(NowTime);
var NumericNowTime = NowTimeGDT.getNumericValue(); var blockTime = currentTimeGDT1.getDate() + " 10:00:00";
var blockTimeGDT = new GlideDateTime(blockTime);
var blockTimeNumeric = blockTimeGDT.getNumericValue(); if (NumericNowTime < blockTimeNumeric) { return; } }
gs.addErrorMessage("Timesheet for " + current.getValue("week_starts_on") + " week is freezed and not allow to be submitted.");
current.setAbortAction(true); }
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 04:46 AM
Hello
You just need to create a field of true/false type on time_card table. In dictionary set the default value to false.
In your BR condition just check like below. In my case field name is different
YOUR BR CODE WILL BE AS IT IS.
Please mark my respsone as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 04:55 AM
Thanks