I have two custom fields: field1 and field2
Also I made sort of behavior for field1
getFieldByName("field1").convertToMultiSelect([
ajaxOptions: [
url: getBaseUrl()+"/rest/scriptrunner/latest/custom/doSomething",
query: true,
minQueryLength: 4,
keyInputPeriod: 500,
formatResponse: "general",
]
])
How can I pass with this behavior any info about field2. I want something like this:
getFieldByName("test-field").convertToMultiSelect([
ajaxOptions: [
url: getBaseUrl()+"/rest/scriptrunner/latest/custom/doSomething",
query: true,
data: [
field_2_Value: value,
field_2_id: id
],
minQueryLength: 4,
keyInputPeriod: 500,
formatResponse: "general",
]
])
And then, how can I catch this info in my endpoint doSomething?
Hi Emil,
Welcome to the Atlassian Community.
I assume the first script is for field 1 and second script is for field 2. Then, you would like to get the field 1 value and pass into the field 2 script?
You can try pass the field1Value in the custom rest endpoint url:
def field1Value = getFieldByName("field1").getFormValue()
getFieldByName("test-field").convertToMultiSelect([
ajaxOptions: [
url: getBaseUrl()+"/rest/scriptrunner/latest/custom/doSomething?field1Value=${field1Value}",
query: true,
minQueryLength: 4,
keyInputPeriod: 500,
formatResponse: "general",
]
])
In the custom rest endpoint, you can catch the field1Value value with this:
def field1Value = queryParams.getFirst("field1Value") as String
I hope this helps. Do let me know if its working for you.
Yes, it did help! Thank you!
But here's a thing. The value of field1Value is null. It's probably because when I'm starting to create an Issue script starting to run and gets field1Value before I set it
Do you know is there any way to create a listener-function that would listen a field1, and pass its' value every time field1 changed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is a way you can use Issue Updated event on the custom listener function and write a script to check the field1 when the field value was changed on the issue.
You can refer some source code here.
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.