当前位置:网站首页>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

边栏推荐
- Manual (functional) test 1
- 2022 recommended high-speed rail industry research report investment strategy industry development prospect market analysis (the attachment is a link to the online disk, and the report is continuously
- Devops development, operation and maintenance Basics: using Jenkins to automatically build projects and notify by email
- Summary of redis basic knowledge points
- Structure training camp module II operation
- Pytest (7) -yield and termination function
- (practice C language every day) matrix
- Testing grpc service with grpcui
- In 2022, I haven't found a job yet. I have been unemployed for more than one year. What is the "old tester" for eight years?
- 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
猜你喜欢

Rich material libraries make modeling easy and efficient for developers

Creation of Arduino uno development environment

Conditional test, if and case conditional test statements of shell script

innography

The first in China! CICA technology database antdb appears at the performance test tool conference of China Academy of communications technology

Cloud native annual technology inventory is released! Ride the wind and waves at the right time

2022 recommended quantum industry research industry development planning prospect investment market analysis report (the attachment is a link to the online disk, and the report is continuously updated

2-nitro-5,10,15,20-tetra (3,5-dimethoxyphenyl) porphyrin (no2tdmpp) H2) /5,10,15,20-tetra (4-methylphenyl) porphyrin (TMPP) H2) Qiyue porphyrin products

Slot

2022 recommended prefabricated construction industry research report industry development prospect market analysis white paper (the attachment is a link to the network disk, and the report is continuo
随机推荐
After nine years of testing, the salary for interviewing Huawei is 10000. Huawei employees: the company doesn't have such a low salary position
Establishing the development environment of esp8266
Love that can't be met -- what is the intimate relationship maintained by video chat
HTTP Caching Protocol practice
Why can't the article be posted?
DANGER! V** caught climbing over the wall!
Tcapulusdb Jun · industry news collection (VI)
机器人强化学习——第一人称 VS 第三人称
Boost the digital economy and face the future office | the launch of the new version of spreadjsv15.0 is about to begin
2022 recommended prefabricated construction industry research report industry development prospect market analysis white paper (the attachment is a link to the network disk, and the report is continuo
Use of sed in shell script
2022 community group buying industry research industry development planning prospect investment market analysis report (the attachment is the online disk link, and the report is continuously updated)
Kubernetes backup disaster recovery service product experience tutorial
The first in China! CICA technology database antdb appears at the performance test tool conference of China Academy of communications technology
HTTP Caching Protocol practice
2,5-di (3,4-dicarboxyphenoxy) - 4 '- phenylethynylbiphenyldianhydride (pephqda) / Qiyue custom supply porphyrin modified amphiphilic block copolymer peg113-pcl46-porphyrin
How to hand over complex legacy systems?
AttributeError: module ‘torch. nn. Parameter 'has no attribute' uninitializedparameter 'solution
CodeIgniter active record not equal - CodeIgniter active record not equal
证券开户安全么,有没有什么危险呢
Be careful : The three properties are the display of drop-down , Click OK to display and the value of this field