Date: Fri, 29 Mar 2024 07:27:01 +0100 (CET) Message-ID: <806050249.494.1711693621972@apps-confluence-5.apps-confluence.apps.svc.cluster.local> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_493_1392811457.1711693621972" ------=_Part_493_1392811457.1711693621972 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
We will explain how to implement a validation for preventing work logs w= ith a beginning date before a time limit in the past.
In particular, we will explain how to avoid work logs where the = associated date is earlier than 10 days in the past, i.e. If we ar= e on march 25th, today we only allow work logs with march 15th or later as = a beginning date.
Enforce work logs through transitions
First we need to enforce users to log all the work using transitions in = our workflows, instead of using "Log Work" operation at th= e issue screen. To do it we will:
Administration > Add-ons=
> Manage add-ons > Filter by "System" > Issue Operations Plugin &=
gt; Disable module "View Issue Ops Bar Work Link"
Typically you will add this transition to "In Progress"= status, but you can add this transition to all statuses easily using a glo= bal reflexive transition.
You can use conditions or validations to limit who can execute these tra= nsition, and thus who can log work.
Now we only need to insert Boolean Valid= ator with math, date-time or text-string terms in "Log= Work" transitions using the following configuration:
Boolean expression used is: datePart({00057}, LOCAL) - dat=
ePart({00166}, LOCAL) <=3D 10 * {DAY}
Note that:
Once all the post-functions have been inserted, transition "Log = Work" will look like this:
If you want to limit valid work logs to dates within current wee= k you should use any of the following validations:
Weeks begin on Sundays
dayOfTheWeek({00057}, LOCAL) <=3D (datePart({00166}, LO=
CAL) - datePart({00057}, LOCAL)) / {DAY} AND (datePart({00166}, LOCAL) - da=
tePart({00057}, LOCAL)) / {DAY} <=3D 7 - dayOfTheWeek({00057}, LOCAL) =
code>
Weeks begin on Mondays
dayOfTheWeek({00057}, LOCAL) !=3D {SUNDAY} ? (2 - dayOfTh=
eWeek({00057}, LOCAL) <=3D (datePart({00166}, LOCAL) - datePart({00057},=
LOCAL)) / {DAY} AND (datePart({00166}, LOCAL) - datePart({00057}, LOCAL)) =
/ {DAY} <=3D 8 - dayOfTheWeek({00057}, LOCAL)) : (-6 <=3D (datePart({=
00166}, LOCAL) - datePart({00057}, LOCAL)) / {DAY} AND (datePart({00166}, L=
OCAL) - datePart({00057}, LOCAL)) / {DAY} <=3D 0)