自動化スマート値 - テキスト フィールド
スマート値のエントリでは:
‘issue’ refers to a work item. What is a work item?
‘project’ refers to a Jira space. What is a Jira space?
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.
以下の例では [要約] フィールドの 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}} -> NullcharAt(int index)
テキスト文字列内の指定位置の文字を識別します。
{{issue.summary.charAt(0)}} -> H
{{issue.summary.charAt(7)}} -> o
{{issue.summary.charAt(12)}} -> NullFor 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)
テキスト文字列の末尾が指定のテキストであるかどうかを確認し、true または false を返します。
{{issue.summary.endsWith("World!")}} -> true
{{issue.summary.endsWith("World@")}} -> falseFor more information, see: String.endsWith(String).
equals(string)
テキスト フィールドを取って、指定した文字列と等しいかチェックします。文字列が等しい場合は true が返されます。条件ロジックで使用できます。
{{issue.summary.equals(“Hello world!”)}} -> true
{{issue.summary.equals(“hello world!”)}} -> falseequalsIgnoreCase(string)
テキスト フィールドを取って、大文字小文字を区別せずに指定した文字列と等しいかチェックします。文字列が等しい場合は true が返されます。条件ロジックで使用できます。
{{issue.summary.equals(“Hello world!”)}} -> true
{{issue.summary.equals(“hello world!”)}} -> true
{{issue.summary.equals(“helloo world!”)}} -> falsehtmlEncode()
テキストをエンコードして 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!")}} -> 11For more information, see: String.indexOf(String).
isAlpha()
テキストに文字のみが含まれるかどうかを確認し、true または false を返します。
{{issue.summary.isAlpha()}} -> trueFor more information, see: StringUtils.isAlpha().
isAlphanumeric()
テキストに文字または数字のみが含まれるかどうかを確認し、true または false を返します。
{{issue.summary.isAlphanumeric()}} -> trueFor more information, see: StringUtils.isAlphanumeric().
isEmpty()
テキストが空かどうかを確認し、true または false を返します。
{{issue.summary.isEmpty()}} -> falseFor more information, see: StringUtils.isEmpty().
isNotEmpty()
テキストが空ではないことを確認し、true または false を返します。
{{issue.summary.isNotEmpty()}} -> trueFor more information, see: StringUtils.isNotEmpty().
isNumeric()
テキストに数字のみが含まれるかどうかを確認し、true または false を返します。
{{issue.summary.isNumeric()}} -> falseFor 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!}ここで、WebResponse.body のスマート バリューは次のように返されます。
{"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")}} -> 9For more information, see: string.lastIndexOf(String).
left(int length)
テキスト文字列の先頭から何番目の文字かを指定して、その文字を返します。
{{issue.summary.left(5)}} -> Hello
{{issue.summary.left(9)}} -> Hello Wor
{{issue.summary.left(2)}} -> HeFor 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()}} -> 12For 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 elloHFor 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}} -> HelloFor more information, see: String.split(String).
startsWith(String str)
テキスト文字列の先頭が指定のテキストであるかどうかを確認し、true または false を返します。
{{issue.summary.startsWith("World!")}} -> falseFor 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)}} -> elFor 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")}} -> HelloFor more information, see: StringUtils. substringBefore(String).
substringBeforeLast(String separator)
最後の指定区切り文字の前のテキストを返します。
{{issue.summary.substringBeforeLast("o")}} -> Hello WFor more information, see: StringUtils. substringBeforeLast(String).
substringBetween(String open, String close)
指定されたパラメーターに挟まれるテキストを返します。
{{issue.summary.substringBetween("e","d")}} -> llo WorlFor 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 エンコード
メールでリンクの作成を送信する際に役立ちます。たとえば、Hello & World は Hello+%26+World とエンコードされます (スペースは + になり、アンパサンドは %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}}
この内容はお役に立ちましたか?