Hi Community,
Unfortunately I'm a beginner in scripting.
We have a requirement when "revised date" field is changed the user has be to update "Reason for revised ETA"
I'm using Script runner's Behaviours to achieve.
I have added the field " revised date" in behahour and added server side script as follows:
I assume you just added the code as "initializer", not actually added it as a script to the added field?
I.e. initializer loads on screen load, only once; but the code added onto a field loads "on change", more or less
Oh right, also reproduced.. my bad, totally forgot they changed that at some point.
Found this that explains it: https://assist.adaptavist.com/browse/SRJIRA-3418?focusedId=478183&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-478183
The workaround there is worth a try. Works locally at least using
import com.atlassian.jira.component.ComponentAccessor
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjects().findByName("FST Analysis")
if (underlyingIssue != null && getFieldById(getFieldChanged()).getValue() != underlyingIssue.getCustomFieldValue(customField)) {
//Run some logic when the current fields value is changed to something other than the current saved value
getFieldById("description").setFormValue("HAHAHA")
getFieldById("description").setRequired(true)
}
On create, underlyingIssue is null, so it can be used as a check whether the issue exists or not. Though it's kind of dirty Adaptavist doesn't appear to think of this as a bug, which I disagree with, until there is a checkbox to ensure it only runs on field changed events.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What do you mean by user input? That's just a test value I used so I can see it when the behaviour works out the condition.
I would guess you should reuse what you had
def fldMyField = getFieldByName("Reason for Revised ETA")
fldMyField.setFormValue(null)
fldMyField.setRequired(true);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Radek,
That doesn't work as well.
After some googling and little modifications the below code works fine for me.
Thank you for your time Radek. Really approceiate it.
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.