自動化スマート値 - テキスト フィールド
The following smart values are available to access and format text strings when setting up a rule. Check out how we use smart values in our Jira automation template library.
The examples below use the Summary field value of Hello World!.
abbreviate(int maxLength)
定義した文字数までテキスト文字列を省略して末尾に「...」を追加します。maxLength パラメーターは 4 以上にする必要があります。
{{issue.summary.abbreviate(8)}} -> Hello Wo...
{{issue.summary.abbreviate(4)}} -> Hell...
For more information, see: StringUtils.abbreviate(int).
asNumber
文字列を取り、可能な場合は数字に変換します。不可能であれば、空値 (Null) を返します。
{{issue.summary.asNumber}} -> Null
charAt(int index)
テキスト文字列内の指定位置の文字を識別します。
{{issue.summary.charAt(0)}} -> H
{{issue.summary.charAt(7)}} -> o
{{issue.summary.charAt(12)}} -> Null
For more information, see: String.charAt(int).
capitalize()
最初の文字を大文字にします。
{{issue.summary.capitalize()}} -> Hello world!
For more information, see: StringUtils.capitalize(String).
concat(String str)
戻り値の末尾に指定のテキスト文字列を追加します。
{{issue.summary.concat(" It's a beautiful day!")}} -> Hello World! It's a beautiful day!
For more information, see: String.concat(String).
endsWith(String str)
Checks if the text string ends with the specified text, and returns true or false.
{{issue.summary.endsWith("World!")}} -> true
{{issue.summary.endsWith("World@")}} -> false
For more information, see: String.endsWith(String).
equals(string)
テキスト フィールドを取って、指定した文字列と等しいかチェックします。文字列が等しい場合は true が返されます。条件ロジックで使用できます。
{{issue.summary.equals(“Hello world!”)}} -> true
{{issue.summary.equals(“hello world!”)}} -> false
equalsIgnoreCase(string)
テキスト フィールドを取って、大文字小文字を区別せずに指定した文字列と等しいかチェックします。文字列が等しい場合は true が返されます。条件ロジックで使用できます。
{{issue.summary.equals(“Hello world!”)}} -> true
{{issue.summary.equals(“hello world!”)}} -> true
{{issue.summary.equals(“helloo world!”)}} -> false
htmlEncode()
テキストをエンコードして HTML コンテンツに含められるようにします。
{{htmlEncode(issue.summary)}} -> Hello world!
HTML レンダリング
Takes a text field that contains wiki markup and converts it to HTML or plain text. Read more about converting wiki markup to HTML
indexOf(String str)
指定テキスト文字列の最初の文字位置を返します。
{{issue.summary.indexOf("Wo")}} -> 6
{{issue.summary.indexOf("ello")}} -> 2
{{issue.summary.indexOf("d!")}} -> 11
For more information, see: String.indexOf(String).
isAlpha()
Checks if the text contains only letters, and returns true or false.
{{issue.summary.isAlpha()}} -> true
For more information, see: StringUtils.isAlpha().
isAlphanumeric()
Checks if the text contains only letters or numbers, and returns true or false.
{{issue.summary.isAlphanumeric()}} -> true
For more information, see: StringUtils.isAlphanumeric().
isEmpty()
Checks to see if the text is empty, and returns true or false.
{{issue.summary.isEmpty()}} -> false
For more information, see: StringUtils.isEmpty().
isNotEmpty()
Checks to see if the text is not empty, and returns true or false.
{{issue.summary.isNotEmpty()}} -> true
For more information, see: StringUtils.isNotEmpty().
isNumeric()
Checks if the text contains only numbers, and returns true or false.
{{issue.summary.isNumeric()}} -> false
For more information, see: StringUtils.isNumeric().
jsonEncode()
Encodes text to allow it to be included in JSON calls, for example, the send outgoing web request action.
{{issue.summary.jsonEncode}} -> Hello World!
View Json encoding below for details on encoding when sending outgoing webhooks as JSON.
jsonStringToObject()
Converts a JSON Formatted String into a JSON Object, who's keys can be accessed via Dot Notation.
{{jsonStringToObject(webResponse.body)}} -> {value=Hello World!}
Where the smart value for webResponse.body returned:
{"value": "Hello World!"}
次のような、配列の配列は機能しません。
{"value": { {"key1": "val1", "key2": "val2"}, {"key3": "val3", "key4": "val4"} } }
配列のオブジェクトなら機能します。
{"value": [ {"key1": "val1", "key2": "val2"}, {"key3": "val3", "key4": "val4"} ] }
lastIndexOf(String str)
指定テキスト文字列の最後の文字位置を返します。
{{issue.summary.lastIndexOf("wo")}} -> 7
{{issue.summary.lastIndexOf("ll")}} -> 4
{{issue.summary.lastIndexOf("rl")}} -> 9
For more information, see: string.lastIndexOf(String).
left(int length)
テキスト文字列の先頭から何番目の文字かを指定して、その文字を返します。
{{issue.summary.left(5)}} -> Hello
{{issue.summary.left(9)}} -> Hello Wor
{{issue.summary.left(2)}} -> He
For more information, see: StringUtils.left(int).
leftPad(int length, String pad)
文字の指定合計数に達するまで、テキスト文字列の先頭に文字を追加します。
{{issue.summary.leftPad(14, "-")}} -> --Hello World!
{{issue.summary.leftPad(20, "|")}} -> ||||||||Hello World!
For more information, see: StringUtils.leftPad(int, String).
length()
テキスト文字列の文字数を返します。
{{issue.summary.length()}} -> 12
For more information, see: String.length().
match()
正規表現検索を実行して最初の (また、1 つのみ) に一致する正規表現グループを返します。
The underlying implementation is based on Java's Pattern class and uses Matcher.find() to find matches. If multiple matches are found, they return as a collection that can be iterated. This can be used to find a single pattern match (e.g. extract a version number from the issue description) or to match multiple patterns (e.g. extract all e-mail addresses from an issue comment).
{{issue.summary.match(".*(lo).*")}} -> lo {{issue.summary.match(".*(o).*")}} -> [o, o]
quote()
Escapes the smart value into a literal text expression that can be used in a regular expression match using Pattern.quote().
{{issue.summary.quote()}} -> \QHello(.*)World!\E<
remove(String remove)
文字をテキストから削除します。
{{issue.summary.remove("l")}} -> Heo Word!
For more information, see: StringUtils.remove(String).
replace(String target, String replacement)
指定した置換内容で一致する文字テキストを置換します。
{{issue.summary.replace("Hello","Goodbye")}} -> Goodbye World!
For more information, see: String.replace(String, String).
replaceAll(String regex, String replacement)
正規表現検索を実行して、一致を変換文字列と置き換えます。"$1" を使用して変換文字列内でマッチング グループにアクセスできます。
{{issue.summary.replaceAll("(lo)","xx$1yy")}} -> Helxxloyy World!
For more information, see: String.replaceAll(String, String).
reverse()
テキスト文字列の文字の順番を逆にします。
{issue.summary.reverse()}} -> !dlroW elloH
For more information, see: StringUtils.reverse().
right(int length)
テキスト文字列の末尾から何番目の文字かを指定して、その文字を返します。
{{issue.summary.right(6)}} -> World!
For more information, see: StringUtils.right(int).
rightPad(int length, String pad)
文字の指定合計数に達するまで、テキスト文字列の末尾に文字を追加します。
{{issue.summary.<br/>rightPadPad(14,"-")}} -> Hello World!--
For more information, see: StringUtils.rightPad(int, String).
split(String separator)
テキストを分割し、テキスト文字列の単語の位置で指定した単語を返します。
{{issue.summary.split(" ").first}} -> Hello
For more information, see: String.split(String).
startsWith(String str)
Checks if the text string starts with the specified text, and returns true or false.
{{issue.summary.startsWith("World!")}} -> false
For more information, see: String.startsWith(String).
substring(int start)
指定した文字数以降の文字を返します。
{{issue.summary.substring(7)}} -> orld!
For more information, see: StringUtils.substring(int).
substring(int start, int end)
指定位置の文字を返します。
{{issue.summary.substring(1,3)}} -> el
For more information, see: StringUtils.substring(int, int).
substringAfter( String separator)
1 つ目の指定区切り文字の後のテキストを返します。
{{issue.summary.substringAfter("W")}} -> orld!
For more information, see: StringUtils.substringAfter(String).
substringAfterLast(String separator)
最後の指定区切り文字の後のテキストを返します。
{{issue.summary.substringAfterLast("o")}} -> rld!
For more information, see: StringUtils. substringAfterLast(String).
substringBefore(String separator)
1 つ目の指定区切り文字の前のテキストを返します。
{{issue.summary.substringBefore("W")}} -> Hello
For more information, see: StringUtils. substringBefore(String).
substringBeforeLast(String separator)
最後の指定区切り文字の前のテキストを返します。
{{issue.summary.substringBeforeLast("o")}} -> Hello W
For more information, see: StringUtils. substringBeforeLast(String).
substringBetween(String open, String close)
指定されたパラメーターに挟まれるテキストを返します。
{{issue.summary.substringBetween("e","d")}} -> llo Worl
For more information, see: StringUtils. substringBetween(String, String).
toLowerCase()
テキスト文字列を小文字に変換します。
{{issue.summary.toLowerCase()}} -> hello world!
For more information, see: String.toLowerCase().
toUpperCase()
テキスト文字列を大文字に変換します
{{issue.summary.toUpperCase()}} -> HELLO WORLD!
For more information, see: String.toUpperCase().
trim()
値の始めまたは終わりにある空白を削除します。
{{issue.summary.trim()}} -> Hello World!
For more information, see: String.trim().
urlEncode()
テキストを URL パラメーターとして含めることができるようにエンコードします (例: メールに含まれるリンク)。
{{issue.summary.urlEncode}} -> See Encoding below.
xmlEncode()
テキストをエンコードして、送信 Webhook などの XML データに含められるようにします。
{{issue.summary.xmlEncode}} -> See Encoding below.
エンコード
他のシステムとの連携またはメール送信には、規格に準拠するため、またはデータを壊さないようにするためにテキストのエンコードが必要なことがあります。たとえば、HTML メールを送信している場合、課題の説明を HTML としてエンコードする必要があるかもしれません。これにより特定の文字は HTML 仕様にエスケープ処理が必要になります。
Html エンコード
HTML エンコードは、メールと HTML ページのエクスポートに便利です。たとえば、Waiting for R&D
は Waiting for R&D
にエンコードされます。
セキュリティ上の理由から、インライン バージョンではなく、関数バージョンのみを使用してください。Webhook 応答 (htmlEncode
というプロパティがある応答) をメールで送信する際、応答を {{webhookData.htmlEncode}}
でエンコードすると、webhookData
の内容をエンコードする代わりに htmlEncode
プロパティの値が返されます。
// Function
{{htmlEncode(issue.status.name)}}
JSON エンコード
発信 Webhook を JSON として送信する際に便利です。たとえば、"Hello World"
は \"Hello World\"
にエンコードされます。
// Function
{{#jsonEncode}}{{issue.summary}}{{/}}
// Inline version
{{issue.summary.jsonEncode}}
URL エンコード
Useful when sending creating links in emails. For example, Hello & World
would be encoded as Hello+%26+World
(the spaces become +, and the ampersand becomes %26).
// Function
{{#urlEncode}}{{issue.summary}}{{/}}
// Inline version
{{issue.summary.urlEncode}}
XML エンコード
発信 Webhook を XML として送信する際に便利です。たとえば、Hello & World
は Hello & World
にエンコードされます。
// Function
{{#xmlEncode}}{{issue.description}}{{/}}
// Inline function
{{issue.description.xmlEncode}}
この内容はお役に立ちましたか?