スマート バリュー - 条件ロジック
The smart values listed on this page can be used with actions where text fields are involved, such as the Add comment or Send email actions. They can be used to print outputs based on conditional logic such as if
or and
statements.
_
構文
{{#if(smartValue)}}
returns true or null.{{#if("string")}}
returns true or null{{#if(smartValue)}}Hello{{/}}
returns Hello or null.{{#if(smartValue, "Hello")}}
returns Hello or null.
例
Let’s say you have a list of issues (perhaps from a Lookup issues action), and you want to add a comment to any that have linked issues. You could use the Add comment action with the following input to add a comment to each issue that has at least one linked issue:
{{#if(not(issue.issuelinks.isEmpty))}}
This bug has {{issue.issuelinks.size}} related tickets
{{/}}
In this case, if an issue has 4 related issues, then the comment This bug has 4 related tickets would be added.
指定の値に等しい
構文
{{equals("string1", "string2")}}
returns true if the two inputs are equal, and false if they aren’t.{{equals(smartValue1, smartValue2)}}
returns true if the two inputs are equal, and false if they aren’t.
例
Let's say you have a process in your team, whereby the assignee and the reporter must be different team members for auditing purposes. You could use the Add comment action with the following input to add a comment to each issue to remind your team that this is the case:
{{#if(equals(issue.assignee, issue.reporter))}}
Assign this issue to someone else so they can review.
{{/}}
This would add the comment Assign this issue to someone else so they can review if the assignee and reporter are the same.
存在する
構文
{{exists(smartValue)}}
returns true or null{{exists("string")}}
returns true or null
例
Let's say you have a custom field on your issues called Designer. You could use any action that prints text (such as Add comment, or Send Slack message) to inform people with the following input:
{{#if(exists(issue.designer))}}
The designer for this issue is {{issue.designer.displayName}}
{{/}}
In this case, if the field Designer has a value, your output would be The designer for this issue is (designer's name).
NOT
構文
{{not(smartValue)}}
returns true or false
例
Let’s say you have a list of issues (perhaps from a Lookup issues action), and you want to add a comment to any that have linked issues. You could use the Add comment action with the following input to add a comment to each issue that has at least one linked issue:
{{#if(not(issue.issuelinks.isEmpty))}}
This bug has {{issue.issuelinks.size}} related tickets
{{/}}
Here, the not smart value checks to see if an issue has at least one related issue. For example, if an issue has 4 related issues, then the comment This bug has 4 related tickets would be added.
および
構文
{{and(smartValue1, smartvalue2)}}
returns true or false
例
Let's say you have a list of issues that have a Votes custom field. You could use the Add comment action to add a comment to all issues that have greater than 100 votes, and less than 150 votes:
{{#if(and(issue.Votes.gt(100),issue.Votes.lt(150)))}}
Moderately Popular issue
{{/}}
This input would add the comment Moderately Popular issue.
または
構文
{{or(smartValue1, smartvalue2)}}
returns true or false
例
Let's say you've got a project that customers use to report bugs, and your issues have a Votes custom field. You could gather a list of issues using the Lookup issues action, and then use the Add comment action to add a comment to all issues that have either more than 100 votes, or more than 20 comments:
{{#if(or(issue.Votes.gt(100),issue.comments.gt(20)))}}
Heavily requested issue
{{/}}
ここで、if スマート値が 100 票を超えるか 20 件のコメントを超えているものを確認して、コメント「Heavily requested issue」を追加します。