Search functions

This page is about Assets & Inventory Plugin for Jira DC. Using Cloud? Click here.

The Asset Navigator search functions provide tools for filtering assets based on their relationships with other assets. This documentation introduces two key functions: referenceAsset and referenceAssetByType.

These functions allow you to target assets based on the values of their referenced assets, enabling you to perform complex and specific searches within the Asset Navigator.

referenceAsset

This feature is introduced at AIP v7.0.1.

referenceAsset function lets you filter assets by referenced assets value. For example, there is a Computer asset that has a Mouse reference asset. You can filter all Computers that have a Mouse and are assigned to a user such as current, reporter, assignee, or a specific user.

You can use this function at Basic Search of Asset Navigator for "Asset List" or "Asset List by Asset Type" type of attributes.

Field names are case-sensitive.

Syntax

referenceAsset("FIELD NAME 1", "VALUE 1", "FIELD NAME 2", "VALUE 2", ..)

Supported fields

"Asset List", "Asset List by Asset Type"

Description

Field name and value pairs are expected. Number of parameters should be an even number.

Examples:

Field name to query

Description

Examples

Field name to query

Description

Examples

Text-Based System Fields:

  • Asset Tag = asset.assetTag

  • owner = asset.owner

  • Serial Number = asset.serialNumber

  • Invoice Number = asset.invoiceNumber



Text-Based Attributes (User defined fields):

  • Text

  • Text Area

  • IP

  • IPv6

  • URL

Use exact field name for attributes. Field names are case sensitive

Query with free text. 

If the text has any double quotes, they must be escaped. For example: "My \"text\" here"

Wildcard search is supported, see: Wildcard search for more details.

Query exact match (surrounded with double quotes) with one text based system field Asset Tag:
    referenceAsset("asset.assetTag", "\"marla singer\"")



With Serial Number:
    referenceAsset("asset.serialNumber", "\"my serial\"")



Query with 3 different type of field values at a time. First Name is a Text field, Jira User is a Jira Single User Select field and Cities is a checkbox field:
    referenceAsset("First Name", "marla", "Jira User", "tyler", "Citites","Ada")



Query for surname that have starts with te. This applies for all text-based fields.
    referenceAsset("Surname", "te*")



Query for a url with exact match:
    referenceAsset("URL", "\"https://appfire.com/\"")

User based System Fields:

  • assigne = asset.assignee

  • owner = asset.owner

  • managed by = asset.managedBy

  • reserved for = asset.ReservedFor



User based Attributes (User defined fields):

  • Jira Single User Select

  • Jira Multiple Users Select

Use exact field name for attributes. Field names are case sensitive



Query with user name or user key.



Variables:

Following variables are available:

  • $currentUser: Current logged-in user

  • $reporter: Issue's reporter or current logged-in user when reporter not found. $reporter is the value of issue reporter field at issue edit/create screens (not linked asset-issues reporter.)

  • $assignee: Issue's assignee. Empty evaluated if not found. $assignee is the value of issue assignee field at issue edit/create screens (not linked asset-issues assignee.)

  • $assigneeOrCurrent: Issue's assignee or current logged-in user when assignee not found.  $assignee is the value of issue assignee field at issue edit/create screens (not linked asset-issues assignee.)

Query with user key:

    referenceAsset("asset.assignee", "JIRAUSER18101")



Query with user name:

    referenceAsset("asset.owner", "tyler")



Query "Jira Users" field contains user "marla" and city is Ada.

    referenceAsset("Jira Users", "marla", "City", "Ada")

User Picker based Attributes (User defined fields)

  • Jira User Picker (Free text input is enabled)

Use exact field name for attributes. Field names are case sensitive

This field stores user name (other user fields holds Jira user key). Additionally enables display name search.



Searching with function variables:

  • $currentUser: Currently logged-in user's name

  • $currentUser.displayName:  Currently logged-in user's display name

  • $currentUser.email:  Currently logged-in user's email



$repoter and $assignee works just like $currentUser, except if $reporter is not found, currently logged in user is used.

  • $repoter

  • $repoter.displayName

  • $repoter.email

  • $assignee

  • $assignee.displayName

  • $assignee.email

Exact user name search:

    referenceAsset("Jira User Picker", "\"agrant-sd-demo\"")



Display name having a word starts with ala (wildcard text search):

    referenceAsset("Jira User Picker", "ala*")



Display name is exactly equals to "Alana Grant"

    referenceAsset("Jira User Picker", "\"Alana Grant\"")



E-mail address is exactly equals to "agrant-sd-demo@example.com"

    referenceAsset("Jira User Picker", "\"agrant-sd-demo@example.com\"")



Search with currently logged in user.

    referenceAsset("Jira User Picker", "$currentUser")



referenceAsset("Jira User Picker", "\"$reporter.email\"")



List based System Fields:

  • Belongs To Group = asset.belongsToGroup

  • Location = asset.location

  • Cost Currency = asset.costCurrency

  • Status = asset.status

  • Substatus = asset.substatus



List based Attributes (User defined fields):

  • Dropdown List

  • List Box

  • List Box - Multiple

  • Radio Button

  • Checkbox

Use exact field name for attributes. Field names are case sensitive

Put 3 @ chars between keywords like "Ada@@@Sel"

Query Cities having İstanbul:

    referenceAsset("Cities", "İstanbul")



Query Cities having Lima or İstanbul:

    referenceAsset("Cities", "Lima@@@İstanbul")



Query Belongs to Group system field having managers:

   referenceAsset("asset.belongsToGroup", "managers")



Query Belongs to Group system field having managers or jira-developers:

    referenceAsset("asset.belongsToGroup", "managers@@@jira-developers")



Query "Status" system field is "In Stock" and "Substatus" system field is "Defective". These values must be English value of the field:

    referenceAsset("asset.status", "In stock", "asset.substatus", "Defective")

Numeric System Fields:

  • Cost = asset.cost



Numeric Attributes (User defined fields):

  • Number Float (with decimals)

  • Number Long (without decimals)

Use exact field name for attributes. Field names are case sensitive

Use dot "." as decimal separator.

Exact search:

    referenceAsset("Item Price", "120.45")

    referenceAsset("Item Age", "21")



Range search:

Between 120 and 139 (120 and 139 are included)

    referenceAsset("Number Float", "120@@@139")



Less than 139 or equal to 139 

    referenceAsset("Number Float", "@@@139")



Bigger than 110 or equal to 110 

    referenceAsset("Number Float", "110@@@")



System field Cost (between 10 and 120) and currency (EUR) search.

referenceAsset("asset.cost", "10@@@120", "asset.costCurrency", "EUR")





Date and Date-Time System Fields:

  • Asset create date time = asset.created

  • Asset update date time = asset.updated

  • Install date = asset.installDate



Date and Date-Time Attributes (User defined fields):

  • Date Picker

  • Date Time Picker

Use exact field name for attributes. Field names are case sensitive

Field value must be in ISO date and date-time format:

  • Date format: YYYY-MM-DD , Example: 2020-12-25

  • Date time format: YYYY-MM-DDTHH:mm  , Example: 2020-06-02T15:45



Exact search:

referenceAsset("asset.installDate", "2020-06-01")



Range search:

referenceAsset("asset.installDate", "2020-05-01@@@2020-06-02")

referenceAsset("asset.installDate", "@@@2020-06-02")

referenceAsset("asset.installDate", "2020-05-01@@@")

"Asset List" and "Asset List by Asset Types" Attributes

Use exact field name for attributes. Field names are case sensitive

Put hashtag before asset Id for reference asset search.

referenceAsset of referenceAsset script search is not ready yet.

Single value search:

referenceAsset("Child Asset", "#644")

Multiple value search:

referenceAsset("Child Asset", "#642@@@#644")

referenceAssetByType

This feature is introduced at AIP v7.0.4.

referenceAssetByType works just like referenceAsset with one more additional parameter, which lets you filter assets by asset type.

referenceAssetByType("ASSET TYPE NAME", "FIELD NAME 1", "VALUE 1", "FIELD NAME 2", "VALUE 2")

Function signature

referenceAssetByType("ASSET TYPE NAME 1", "FIELD NAME 1", "VALUE 1", "FIELD NAME 2", "VALUE 2", ...)

Description

Asset type, field name and value parameters are expected. Number of parameters should be 3, 5, or 7.

Example:  referenceAssetByType("Mouse", "Model", "pandas", "Vendor", "apple")

Screenshots of usage

Personal Computer has Mouse Inventory and assets are filtered by reference assets having asset type=Mouse, model=pandas, vendor=apple.

Final search script is: referenceAssetByType("Mouse", "Model", "pandas", "Vendor", "apple")