Linked Worklog Attributes
Sometimes you only want to allow specific values depending on the selected value of another worklog attribute. Let's consider an example scenario.
Assume that you have “User Role” and “Work Type” attributes. Depending on value of the selected “User Role”, you want to limit which “Work Type” attributes can be selected.
We have applicability rules for worklog attributes, but these only allow you to limit applicability based on issue, user, project etc. Not the value of other attributes. So, we need to find another way to handle these inter linked attributes.
For “User Role” you can specify abbreviations like QA, DBA etc. as suffixes. You can also use the same abbreviations as prefix/suffixes to “Work Type” attribute values as well. So, users can visually know which “Work Type” attribute is applicable for which “User Role” attribute. In addition to that, create a worklog verification script which checks this rule. If user doesn’t choose an allowed value for “Work Type” they will not be able to submit the “Log work” dialog and they will receive an error message.
Script Content:
$contains(worklog.attributes.`Work Type`.value, $substringBefore($substringAfter(worklog.attributes.`User Role`.value, "("), ")"))
Error Message:
You should choose a "Work Type" matching your "User Role"