Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • Community
  • Q&A
  • Jira
  • Questions
  • Is it possible to clear a field when editing another field, before clicking the "update" button?

Calling the Rest APIS from jira scriptrunner

farhan_shaik97
May 9, 2023

I want to call the external systems(any other App) API from Jira ScriptRunner using a groovy script.

i ran the script but its throwing errors because of these libraries

import groovy.json.JsonOutput
import groovyx.net.http.ContentType
import groovyx.net.http.HttpResponseDecorator
import groovyx.net.http.RESTClient

 

Errors:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 4: unable to resolve class groovyx.net.http.RESTClient @ line 4, column 1. import groovyx.net.http.RESTClient ^ Script1.groovy: 2: unable to resolve class groovyx.net.http.ContentType @ line 2, column 1. import groovyx.net.http.ContentType ^ Script1.groovy: 3: unable to resolve class groovyx.net.http.HttpResponseDecorator @ line 3, column 1. import groovyx.net.http.HttpResponseDecorator

 

can any one help me on how to get this working is there any way we can upload libraries in script runner which are popping this errors.

 

Thank you.

 

1 answer

1 vote
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
June 18, 2018

Hello @Shirley He

Yes, you can achieved it with Scriptrunner Behaviors.

Add-ons -> Behaviours

Add behavior, add mapping to your project and issue types.

Fields -> Add field2(field that will be trigger clearing)

add server-side script:

 

def field1 = getFieldByName("field to clear name")

def field2 = getFieldById(getFieldChanged())

field1.setFormValue(null)
Pratibha Tambakad
November 30, 2022

Hello Markov,

I have used the code snippet to achieve one of my requirements similar to this. but Whenever I open edit screen to edit the value of the field its not showing the currently selected values

Example I have 2 fields Country and Region, and both are multiselect fields. Currently 

field Region is having 3 values A,B,C. and when i open the edit screen it won't show these selected values it will just allow us to select new values after using the code snippet

Please provide me any solution if you have

Suggest an answer

Log in or Sign up to answer