I am trying to set the Priority field to a specific value via a Behaviour. This is my code:
FormField formPriority = getFieldById(IssueFieldConstants.PRIORITY)
List<String> myList = new ArrayList<String>();
myList = "5"
There is no error in the script, but it does not set the value.
/rest/com.onresolve.jira.plugin.Behaviours/1.0/behaviours/runvalidator.json [onresolve.jira.groovy.BehaviourManagerImpl] Returning map: [priority:[setValue:, fieldType:com.atlassian.jira.issue.fields.PrioritySystemField, displayName:Priority]]
Anybody knows what is wrong with this script? Does the setFormValue for Priority field take string/list/object?
I guess you will need to pass the value of the priority as argument
If we observe the HTML
<option class="imagebacked" data-icon="/images/icons/priority_minor.gif" value="4"> Minor </option>
value is 4 so ,
Will set the priority as minor
Hope this helps
The stange thing is when the behaviour executes on my create issue page, shouldnt the priority field value change there? I can see the behaviour script has executed, but the create page shows the default value only. When I submit the page, I can see the issue is created with my updated priority value.
Yes I tried with getFieldById("priority") as well. After submitting the page the priority changes to the one I want. But the the Priority value in the drop down does not change when I am on the Create page.
I tried putting in a sample Description value, and that comes up properly.
You will need to add the groovy script as a server side script in the priority field . So as soon as the page is loaded the priority will be set according to your script . It will get triggered automatically .
Just to confirm you are adding this script in the text area provided by the behaviours plugin , right ?
Yes, I tried adding for the Priority field as well. The behaviour executes, but the Create page still shows the system default priority.
import com.atlassian.jira.issue.IssueFieldConstants import java.util.List FormField formPriority = getFieldById("priority") List<String> myList = new ArrayList<String>() myList = "5" formPriority.setFormValue(myList)
Only after submitting it, can I see the priority set properly on the View page.
The reason I added the behavior on the Summary field was, the user should be able to change the priority if he wants. If I add the behaviuor on the Priority field itself, it will not allow changes to it.
And Yes, the script is in the text area of the Behaviour plugin.
I have not seen such issue earlier .
If I add the behaviuor on the Priority field itself, it will not allow changes to it.
This is not correct the user can change the priority later . Your script will execute only once the page is loaded .
I tried the script at my end and observed that the option is disappearing when the script run .
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG