Hi Everyone,
I have two behavior script which works fine. Now I want to access the value stored in one script to another. I tried accessing the value in behavior script initializer but I am getting null value.
Behavior script :
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
@BaseScript FieldBehaviours fieldBehaviours
def A = getFieldById("customfield_16355")
Object A_val = A.getFormValue() as int
def A_Hours = getFieldById("customfield_16365")
Object A_Hour = 125*A_val
A_Hours .setFormValue(A_Hour )
Now when I tried to get value of field which is set by using A_Hours .setFormValue(A_Hour ) in the other behavior script OR in the initializer console of behavior script but I am getting null value.
Could you please help me on this.
Thanks,
Suchit
Ok, I'll take a stab at this... I see no one is daring to answer.
The short answer is no, there is no cross-talk possible between server-side behaviour script.
The longer answer requires some explanation of what behaviour does.
When you open a screen (create, edit, transition), there is a bunch of back and forth between browser-side scripts and the jira server backup using special rest endpoints supplied by scriptrunner.
Then each time you modified a field included in the response listed in #3, that validator is re-un using new and updated data.
You see, each of those server-side requests are executed in a standalone transaction. So one is not aware of what is happening to the other.
Now, if you have some fields that are interdependent, you may need to combine your 2 scripts and run them from each of your fields.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.