Using placeholders in AQL to dynamically replace information
Assets supports a variety of placeholders that let you dynamically replace specified placeholders with values from Jira work item fields, Assets object attributes, or other related information, depending on the context.
Examples of when to use placeholders
Placeholders are useful when configuring actions where the value depends on the runtime context. For instance, we may not know which object will trigger the action, so we can't determine the value in advance.
Example 1: Receive an email when a license is about to expire, including the license name and end date.
Example 2: Set or update an object attribute with the value from an Jira work item field when the work moves to a specific status.
In both examples, we know where to find the value, but not the specific value at the time of configuration. This is why placeholders are essential—they help us "find the desired value" when needed.
プレースホルダーの構造
構文
|
These multiple structures provide a range of configuration options. The following table explains how each structure is used.
プレースホルダー | 動作 | プレースホルダーの例 | 値に置き換える |
---|---|---|---|
${Name of placeholder} | Replaces the content ${Name of placeholder} with the value matched by Name of placeholder. | ${Name} | 1 つのオブジェクト |
${Email} | myemail@fakse.se,anotheremail@fakse.se | ||
${Name of placeholder${0}} | ${Name of placeholder${0}} のコンテンツを、プレースホルダーの名前と一致するすべての値と置き換えます。これは複数の値を一致させるために使用されて (複数のカーディナリティを持つ属性を設定する際など)、すべての値はその属性の 1 つのインスタンスになります。テキストとして置き換えた際は上記の例に似ています。複数の値のコンテキストで置き換えた際はこの表記法によって複数の値がレンダリングされますが、上記の場合は 1 つの値をコンマ区切り文字列としてレンダリングします。 | ${Price${0}} | 12 |
${Email${0}} | myemail@fakse.se,anotheremail@fakse.se | ||
${Name of placeholder${1}} | Replaces the content ${Name of placeholder${1}} with the first value matched by Name of placeholder. This is used when only the first value is required. | ${Price${1}} | 12 |
${Email${1}} | myemail@fake.se | ||
${Name of placeholder${n}} | Replaces the content ${Name of placeholder${n}} with the n:th value matched by Name of placeholder. This is used when only the n:th value is required. | ${Price${2}} | <空の値> |
${Email${2}} | anotheremail@fakse.se | ||
${Email${4}} | <空の値> |
プレースホルダーのコンテキスト
Sometimes, placeholders can return multiple values. In such cases, you can use the placeholder format ${Name of placeholder${i}}
, where i
represents the index number.
The most common configuration is ${Name of placeholder${0}}
, which generates a comma-separated list of all values provided by the placeholder, for example:
|
You can also use ${Name of placeholder${1}}
to retrieve only the first value from the list of values provided by the placeholder.
Placeholders when importing
Learn more about placeholders when importing into Assets
Placeholder name | 値 |
---|---|
Data locator | The value that is found in the external data source from the data locator. |
プレースホルダーは AQL (アセット クエリ言語) の一部として使用されます。
自動化
Learn more about automating Assets
Placeholder name | 値 | 説明 |
---|---|---|
属性名 | 属性値 | プレースホルダーと同じ名前の属性の値。これによって、人間が読み取れる形式で属性がレンダリングされます。 |
Attribute Name.id | 格納された属性値 | プレースホルダーと同じ名前の属性の値。これによって、格納された形式で属性がレンダリングされます。たとえば、属性がオブジェクト参照の場合は、参照されたオブジェクト ID がレンダリングされます。これは、提示された値とは別の値で格納された属性でのみ機能します。 |
ラベル | オブジェクトのラベル | 値は、オブジェクトに設定されたラベルに置き換えられます。 |
objectType | オブジェクトのオブジェクト タイプ名 | 値はオブジェクト タイプ名で置き換えられます。 |
objectTypeId | オブジェクト タイプ ID | 値は、現在のオブジェクトのオブジェクト タイプ ID に置き換えられます。 |
objectId | オブジェクト ID (キー以外) | このオブジェクトを識別する整数。 |
鍵 (キー) | オブジェクトのキー | 現在のオブジェクトのキー値。 |
Object create or edit
When creating or editing objects with reference attributes, you can use AQL to limit the selection of objects. The available placeholders are all the attributes in the create/edit dialog.
Placeholder name | 値 | 説明 |
---|---|---|
属性名 | 属性値 | プレースホルダーと同じ名前の属性の値。これによって、人間が読み取れる形式で属性がレンダリングされます。 |
Attribute Name.id | 格納された属性値 | プレースホルダーと同じ名前の属性の値。これによって、格納された形式で属性がレンダリングされます。たとえば、属性がオブジェクト参照の場合、これは参照されるオブジェクトの ID になります。 |
The placeholders in the AQL are always the values on the right-hand side of the configuration. These placeholders are replaced by values from the current object, while the AQL references attributes from the target object type.
Placeholders cannot be used in the Filter scope (AQL) field in the Objects field configuration screen.
この内容はお役に立ちましたか?