当前位置:网站首页>JIRA basic usage sharing
JIRA basic usage sharing
2022-06-29 05:52:00 【"Wood"】
Jira Basic use sharing
jira All scripts in groovy grammar
1. obtain Field Value
1.1 Get... In the current page Field Value
def systemField = getFieldByName("Field Name")
def value = systemField.getValue()
1.2 Get current issue Of other pages in Field Value
import org.apache.log4j.Level
import org.apache.log4j.Logger
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor
def log = Logger.getLogger("data-api")
log.setLevel(Level.INFO)
MutableIssue issue = (MutableIssue) getUnderlyingIssue()
def optionName = ComponentAccessor.customFieldManager.customFieldObjects.findByName("Field Name")
def optionValue = issue.getCustomFieldValue(optionName)
log.info("request term name is:" + optionValue)
1.3 Get radio / Multiple choice values
1. stay Behavious Initialize first . Do the following → 2.1 step
2. Yes, multiple choice / Select a single field to operate , Find the field , Click on Add

3. Code in the coding area , Here's the picture

import org.apache.log4j.Level
import org.apache.log4j.Logger
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor
def isSystemField = getFieldById(getFieldChanged())
def Value = isSystemField.getValue()
2. The radio or multi-select
1.Jira Administrator account login , Click on the pinion , choice Manage apps

2. Enter into Behaviours, Query according to the following syntax

2.1 Document reference
ScriptRunner for jira Server: https://docs.adaptavist.com/sr4js/latest/features/behaviours/behaviours-examples/select-list-conversions.
// The radio
getFieldByName("TextFieldA").convertToSingleSelect([ // <1>
ajaxOptions: [
url : getBaseUrl() + "/rest/scriptrunner-jira/latest/issue/picker",
query: true, // keep going back to the sever for each keystroke
// this information is passed to the server with each keystroke
data: [
currentJql : "project = SSPA ORDER BY key ASC", // <2>
label : "Pick high priority issue in Support project", // <3>
showSubTasks: false, // <4>
// specify maximum number of issues to display, defaults to 10
// max : 5,
],
formatResponse: "issue" // <5>
],
css: "max-width: 500px; width: 500px", // <6>
])
// multi-select
getFieldByName("TextFieldC").convertToMultiSelect([
ajaxOptions: [
url : getBaseUrl() + "/rest/scriptrunner/latest/custom/eventTypes",
query : true,
formatResponse: "general"
]
])
2.2 function script
1. First of all, the script should be Mapping
Let the script know , This function Corresponding Project and issue type

2. combination UI Test the interface
2.3 see log
1. find Built-in script

2. Slide to the bottom

3. choice jira log

3. Call outside Api
Official document link : https://scriptrunner.adaptavist.com/4.3.5/jira/behaviours-conversions.html#_walkthrough_pick_from_jira_issues.
3.1 Package external api, find Rest Endpoints

import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonBuilder
import groovy.transform.BaseScript
import groovyx.net.http.ContentType
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.Method
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
@BaseScript CustomEndpointDelegate delegate
githubRepoQuery(httpMethod: "GET") {
MultivaluedMap queryParams ->
// Here for Behaviours in api Passed parameters
def query = queryParams.getFirst("query") as String
def rt = [:]
if (query) {
def httpBuilder = new HTTPBuilder("https://api.github.com")
def repos = httpBuilder.request(Method.GET, ContentType.JSON) {
uri.path = "/search/repositories"
// Assign a value
uri.query = [q:"$query in:name", sort: "stars", order:"desc"]
headers."User-Agent" = "My JIRA"
response.failure = {
resp, reader ->
log.warn("Failed to query GitHub API: " + reader.text)
}
}
def repoNames = repos["items"]*."full_name"
rt = [
items: repoNames.collect {
String repo ->
[
value: repo,
html : repo.replaceAll(/(?i)$query/) {
"<b>${it}</b>" },
label: repo,
]
},
total: repos["total_count"],
footer: "Choose repo... (${repoNames.size()} of ${repos["total_count"]} shown...)"
]
}
return Response.ok(new JsonBuilder(rt).toString()).build();
}
=> external api The packaging format of
Be careful : The three properties are the display of drop-down , Click OK to display and the value of this field
3.2Behaviours call Endpoints, Generally, it is a single choice / multi-select
getFieldByName("TextFieldB").convertToMultiSelect([
ajaxOptions: [
url : getBaseUrl() + "/rest/scriptrunner/latest/custom/githubRepoQuery",
query: true, // keep going back to the sever for each keystroke
minQueryLength: 4,
keyInputPeriod: 500,
formatResponse: "general",
]
])
3.3UI Interface tests , The picture is for reference only

3.4 Multi level linkage , Fuzzy query through the contents of the input box
// An highlighted block
var foo = 'bar';
4.jql Inquire about Jira issue
1. Get into issue Query interface

2. Regular query
Select the corresponding issue The state of OK La

3. Execute statement query

link : Official query statement document reference .
Demo:jql language
note: The time is only mm / DD / yyyy , No seconds
project = aaaa and type = done and epic = ''
5. encapsulation Jira Service
take your time , Don't worry

边栏推荐
- Analysis report on the investment market of the development planning prospect of the recommended wind power industry research industry in 2022 (the attachment is a link to the network disk, and the re
- Use typescript compiler parameter 'skiplibcheck' - usage of the typescript compiler argument'skiplibcheck'
- 2022 recommended tire industry research report industry development prospect market analysis white paper
- The win11 file resource manager has an explicit Caton, and Microsoft promises to improve the performance in 2022
- Analysis report on the investment market situation of the development planning prospect of the recommended chip industry research industry in 2022 (the attachment is a link to the network disk, and th
- See how I do it step by step (I)
- Hustoj SPJ example
- The easiest GUI to compile: dgui
- Difference between parametric continuity and geometric continuity
- How to insert pseudo code into word documents simply and quickly?
猜你喜欢

开启生态新姿势 | 使用 WordPress 远程附件存储到 COS

2022 recommended property management industry research report industry development prospect market investment analysis (the attachment is the link to the online disk, and the report is continuously up

Hustoj SPJ example

ES6 Modularization: export /import

Blip: conduct multimodal pre training with cleaner and more diverse data, and the performance exceeds clip! Open source code

Easy to get started naturallanguageprocessing series topic 7 text classification based on fasttext

HTTP Caching Protocol practice

Tcapulusdb Jun · industry news collection (V)

See how I do it step by step (I)

Openfpga wishes you a happy Lantern Festival!
随机推荐
It turns out that the joys and sorrows of programmers are not interlinked
β- Tetraphenyl nickel porphyrin with all chlorine substitution| β- Thiocyano tetraphenyl porphyrin copper| β- Dihydroxy tetraphenyl porphyrin 𞓜 2-nitroporphyrin | supplied by Qiyue
innography
Research Report on recommended specialized, special and new industries in 2022 industry development prospect and market investment analysis (the attachment is a link to the online disk, and the report
How to insert pseudo code into word documents simply and quickly?
PCI Verilog IP
Testing grpc service with grpcui
RTOS embarqués
Blip: conduct multimodal pre training with cleaner and more diverse data, and the performance exceeds clip! Open source code
Meso tetra (4-N, N, n-trimethylaminophenyl) porphyrin (ttmapp) /meso tetra - [4- (BOC threonine) aminophenyl] porphyrin (TAPP thr BOC) supplied by Qiyue
Rich material libraries make modeling easy and efficient for developers
Would like to ask, which is the better choice for securities companies? I don't understand. Is it safe to open an account online now?
Use of sed in shell script
Analysis report on the investment market of the development planning prospect of the recommended rare earth industry research industry in 2022 (the attachment is a link to the online disk, and the rep
The translation of those exquisite lines in the eighth season of the big bang
Purple red solid meso tetra (o-alkoxyphenyl) porphyrin cobalt (meso-t (2-rop) PCO) / tetra (n, n-diphenyl-p-amino) phenyl porphyrin (tdpatph2)
gan semi conductor
VLAN experiment
DataX connection MySQL cannot find driver
Difference between parametric continuity and geometric continuity
Be careful : The three properties are the display of drop-down , Click OK to display and the value of this field