Hello,
We have a use case where we need to restrict a transition to a custom field value (group picker). But, when the field is left empty, We want users who has transition permissions to the issue should be able to do the transition. (we want other users to close the issue when the group picker field is empty. when there is a group selected, only the members in the group should be able to close the issue).
Hello,
You would need an add-on for it.
For example, you could use the Power Scripts add-on:
You could write a condition like this:
string selectedGroup = #{Your Group Picker Name};
if (isNotNull(selectedGroup) && userInGroup(selectedGroup, currentUser())) {
return true;
}
return false;
Then you can attach this condition to the transition leading to the Closed status. In this case only users in the selected group can see this transition.
You can find more info about conditions here:
https://confluence.cprime.io/display/JJUPIN/Customizing+workflows
Thanks for the response. I tried the script but it is not opening the transition when there is no value in the group picker. Our requirement is when there is some value selected in the group picker, the transition should be locked to the group selected otherwise, it should be open to everyone.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see.
Try like this:
string selectedGroup = #{Your Group Picker Name};
if (isNull(selectedGroup) || userInGroup(selectedGroup, currentUser())) {
return true;
}
return false;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the response and sorry for getting back here very late. Our requirement changed a bit.
We want to restrict a transition to values of custom fields (in our case we have two user picker fields). But, when the fields are left empty, We want users who has transition permissions to the issue should be able to do the transition. One user should be given exception from restriction. That person should be able to close at any time. I wrote below script but it is throwing an error but not showing what the error is.
Can you please assist.
string selectedUPF1 = "UPF1"; //UPF1 is a user picker field.
string selectedUPF2 = "UPF2"; //UPF2 Member is a user picker field.
if(currentUser() == "aguttikonda"){
return true;
}
if (isNotNull(selectedUPF1) && matches(selectedUPF1, currentUser())) {
return true;
}
if(isNotNull(selectedUPF2) && matches(selectedUPF2, currentUser())){
return true;
}
return false;
Thanks in Advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the return false statement you should add the error message:
return false, "your message here";
You can find more examples here:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is still not working. it is working for first 'If' but is not working for next two. Do you think 'Matches' is the correct method here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for umping in and been helping me on this. I was able to figure out and fix it.
Thanks once again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.