How to Create a JQL Parser for Custom Field Object Properties

Hi Community,

I have a custom field of type object with the following properties:

  • weight: number (stores weight in kilograms)

  • name: string

I want to allow users to write JQL queries like:
"myCustomField.weight" < 1ton

And have it parsed automatically to:
"myCustomField.weight" < 1000

Here’s a simplified example of the custom field definition:

key: weight-tracker
type: object
schema:
  properties:
    weight:
      type: number
      searchAlias: weight
    name:
      type: string
      searchAlias: name
formatter:
        expression: |-
           return value/1000
parser:
  expression: |-
    // Need to interpret "ton" and convert to kg
2 Likes

Hi,
Can’t you parse the string “1t” with regex and multiply it with 1000 in parser expression?