Hello, I have 4 custom fields: "customer priority", "Impact", "Urgency" and "calculated priority".
When customer priority is empty, Impact = "high" and Urgency 'High" then calculated priority = 1.
I need to calculate this at Create Issue, so user fills in value for Impact and Urgency and leaves Customer Priority empty and Jira calculated the Calculated Priority.
I understand I can't do this in a Post function, because the values are not stored in database yet, from this article (https://community.atlassian.com/t5/Jira-questions/Making-a-JIRA-field-required-based-on-a-value-chosen-on-the/qaq-p/247284) I understand I have to user Validator to retrieve chosen value of Customer Priority, Urgency and Impact to calculate my Calculated Priority. But which Validator do I use and how?
Hi @Sandra Meessen,
You can make it using Automation Lite for Jira just creating one condition for each case. In addition, this app is free and Atlassian Verified.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Without extra apps I did it once with Jira Service Desk Automation but... it's still the same solution.
I have no idea how to do it without any extra app.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Sandra Meessen , From screenshot, i think you already have the ScriptRunner plugin. Have you checked using the behaviours?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I have Scriptrunner and Behaviours, but I don't know how to set the Behaviours for my requirement. Do I add the fields Customer Priority, Urgency, Impact or do I add the field Calculated Priority?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Fazila, I'm trying to setup the Behaviour and come to this point. My code looks logically ok and gives a green bullet for syntax, but which field do I choose (red circle). The one I want to calculate? Or the one(s) I use to calculate? I mapped the Behaviour to my project, issuetypes and workflow. Thank you for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hell @Fazila Ashraf, As I understand from the documentation (https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html) the field defined should be the field I use to calculate the other field, but in my situation I use three custom fields to calculate 1 other custom field. So which field do I define in the Behaviour? The custom field I want to calculate is of type "select list (single choice)"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ello @Fazila Ashraf, In the meantime I found out that I should use the value to set my custom field, but the ID (https://community.atlassian.com/t5/Marketplace-Apps-questions/Behavior-Plugin-Setting-value-of-a-Select-custom-field-based-on/qaq-p/80357) , but it still doesn't work. Based on the advice in this article I end up with this code in the "initialiser function":
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor
// Get a pointer to my select list fields
def klantprioSelectList = getFieldByName("Klantprioriteit")
def berekendepriorequestTypeSelectList = getFieldByName("Berekende prioriteit")
// Get the Value of the Klantprioriteit Field
def klantprioVal = klantprioSelectList.getValue()
// If the XX option is selected then set the "Berekende prioriteit" to Option yy
if(klantprioVal == "1"){
// Set the value of the field using the option ID for the yy value
berekendepriorequestTypeSelectList.setFormValue(10070)
}
What's wrong in the code and is the "initialiser function" the correct place to put it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am so sorry that i dint see your followups and totally missed that you have multiple fields by which the value depends on..
Instead of behaviours, using the scripted fields (from the same script runner plugin) will help this. -> https://scriptrunner.adaptavist.com/latest/jira/scripted-fields.html
A sample is as below:
Let me know if you need any further help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Validators are used to validate the inputs and decide whether to allow the transition or not.
For your scenario, i would use the Scriptrunner's (commercial plugin) behaviour - https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html
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.