Hello,
In Jira Server, I would like to block a transition as long as a field (assignee) has not been modified from its original value. Do you have a solution for that ?
Can Script runner be used ?
Thank you.
Nath
Hi @Nath ,
Script Runner could indeed be used for that, more specifically behaviours. You can compare the form value to the actual value (using underlyingIssue object). If they are the same, you can set an error on the form. Let me know if you need more guidance.
Antoine
Hi,
I try to recover the initial value of the field "assignee" and the one entered by the user, but I do not have the same result, while the target user is identical. Is there a method to obtain comparable results, or should I reprocess the initial data obtained, to obtain comparable elements ?
Thank you in advance for your help.
Here is the code in my Behaviours :
String fieldAssignee = getFieldById("assignee") fieldAssignee.setRequired(true) String assigned = underlyingIssue.assignee?.displayName
String myValue = underlyingIssue.assignee
if (myValue == fieldAssignee)
{
fieldAssignee.setError("My error")
}
Nath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I try to recover the initial value of the field "assignee" and the one entered by the user, but I do not have the same result, while the target user is identical. Is there a method to obtain comparable results, or should I reprocess the initial data obtained, to obtain comparable elements ?
Thank you in advance for your help.
Here is the code in my Behaviours :
String fieldAssignee = getFieldById("assignee") fieldAssignee.setRequired(true) String assigned = underlyingIssue.assignee?.displayName
String myValue = underlyingIssue.assignee
if (myValue == fieldAssignee)
{
fieldAssignee.setError("My error")
}
Nath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nath,
Try this (link the behaviours to the Assignee field) :
def formAssignee = getFieldById("assignee")
formAssignee.setRequired(true)
def formAssigneeValue = (formAssignee.getValue() == null) ? "" : formAssignee.getValue().toLowerCase()
String issueAssigneeValue = (underlyingIssue.getAssignee() == null) ? "" : underlyingIssue.getAssignee().getKey().toLowerCase()
if (formAssigneeValue == issueAssigneeValue){
formAssignee.setError("My error")
}
else {
formAssignee.clearError()
}
Antoine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Antoine,
Thank you very much for the help! I just replaced that :
def formAssigneeValue = (formAssignee.getValue() == null) ? "" : formAssignee.getValue().toLowerCase()
with that :
String formAssigneeValue = (formAssignee.getValue() == null) ? "" : formAssignee.getValue().toString().toLowerCase()
Now everything is ok. Thank you so much for your help.
Nath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.