Rootly built-in

find

  • find: arg1, 'arg2'

    • arg1. String

    • arg2. String

JS
// Pretending object is the following object [{"id": "apple"}, {"id": "banana"}]
{{ object | find: 'id', 'banana' }}
// Output
// {"id": "banana"}

get

  • get: 'arg'

    • arg. String
JS
// Pretending object is the following object {"id": "id", "incident": {"title": "Something is on fire!"}
{{ object | get: 'incident.title' }}
// Output
// Something is on fire!

smart_date

JS


{{ 'now' | smart\_date: 'tomorrow' }}
// Output
// 2023-06-29 12:00:00 -0700

slice

  • slice: '\*arg'

    • arg. String

    • … As many args as you need

JS


// Pretending object is the following object {"key": "hello", "value": "world", "foo": "bar"}

{{ object | slice: 'key' }}

// Output
// {"key": "hello"}

{{ object | slice: 'key', 'foo' }}

// Output
// {"key": "hello", "foo": "bar"}

flatten

  • flatten
JS

// Pretending object is the following object \["1", "2", \["3"\]\]
{{ object | flatten }}
// Output
// \["1","2","3"\]

to_values

  • to\_values: 'key'

    • key is optional
JS

// Pretending object is the following object {"key": "hello", "value": "world"}
{{ object | to\_values }}

// Output
// \[{"value":"world"}\]

{{ object | to\_values: 'key' }}

// Output
// \[{"value":"hello"}\]

to_json

  • to\_json
JS
// Pretending object is the following object [{"key": "hello", "value": "world"}]
{{ object | to_json }}
// Output
// [{"key":"hello","value":"world"}]

to_iso8601

  • to\_iso8601
JS
// Pretending object is the following object [{"key": "hello", "value": "world"}]
{{ object | to_json }}
// Output
// [{"key":"hello","value":"world"}]

distance_of_time_in_words

  • distance\_of\_time\_in\_words: 'arg', 'precise'

    • arg. String (optional)

    • precise. String (optional)

JS
{{ 3720 | distance_of_time_in_words }}
// Output
// about 1 hour
{{ 3720 | distance_of_time_in_words: 0, 'precise' }}
// Output
// 1 hour and 2 minutes
{{ 'May 1, 2020' | distance_of_time_in_words: 'May 31, 2020' }}
// Output
// about 1 month
{{ 'May 1, 2020' | distance_of_time_in_words: 'May 31, 2020', 'precise' }}
// Output
// 4 weeks and 2 days

distance_of_time_in_words_to_now

  • distance\_of\_time\_in\_words\_to\_now: 'precise'

    • precise. String (optional)
JS
{{ 'May 1, 2020' | distance_of_time_in_words_to_now }}
// Output
// over 2 years
{{ 'May 1, 2020' | distance_of_time_in_words_to_now: 'precise' }}
// Output
// 2 years and 7 months

in_time_zone

  • in\_time\_zone: 'time\_zone'

    • time\_zone. Any timezone listed in Timezones
JS

{{ now | in\_time\_zone: 'Europe/London' | date: '%Y-%m-%d %H:%M %Z' }}

See Timezones for available values

to_table

  • to\_table: 'table\_type', 'title', 'time\_zone', 'format'

    • table\_type is either events or action_items

    • time\_zone. Any timezone listed in Timezones

    • format can be ascii , markdown , html, atlassian_markdown

JS

{{ incident.events | to\_table: 'events', 'Hello world', 'America/Los\_Angeles', 'markdown' }}

regex_replace

Global replace

  • regex\_replace: 'regex', 'replacement'

    • regexp a ruby regular expression

    • replacement a ruby regular expression

JS
{{ 'foo bar 123 456' | regex_replace: '\\d+', 'baz' }}
// Output
// foo bar baz baz

regex_replace_first

First match replace

  • regex\_replace\_first: 'regex', 'replacement'

    • regexp a ruby regular expression

    • replacement a ruby regular expression

JS
{{ 'foo bar 123 456' | regex_replace: '\\d+', 'baz' }}
// Output
// foo bar baz 456

regex_remove

Global match remove

  • regex\_remove: 'regex'

    • regexp a ruby regular expression
JS
{{ 'foo bar 123 456' | regex_remove: '\\d+' }}
// Output
// foo bar

regex_remove_first

First match remove

  • regex\_remove\_first: 'regex'

    • regexp a ruby regular expression
JS
{{ 'foo bar 123 456' | regex_remove_first: '\\d+' }}
// Output
// foo bar  456

dasherize

  • dasherize
JS
{{ 'hello_world' | dasherize }}
// Output
// hello-world

parameterize

  • parameterize

    • separator (default to ’-‘)
JS
{{ 'Hello World' | parameterize }}
// Output
// hello-world
{{ 'Hello World' | parameterize: '_' }}
// Output
// hello_world

camelize

  • camelize
JS
{{ 'hello world' | camelize }}
// Output
// Hello world

titleize

  • titleize
JS

{{ 'hello world' | titleize }}
// Output
// Hello World

singularize

  • singularize
JS
{{ 'cars' | singularize }}
// Output
// car

pluralize

  • pluralize
JS
{{ 'car' | pluralize }}
// Output
// cars

humanize

  • humanize
JS
{{ '0' | humanize }}
// Output
// No
{{ '1' | humanize }}
// Output
// Yes
{{ 'incident_management' | humanize }}
// Output
// Incident Management

shuffle

  • shuffle
JS
{{ '123456789' | shuffle }}
// Output
// 973426581

Liquid built-in

shortener

  • shortener
JS
{{ 'https://rootly.com/account/incidents/123456' | shortener }}
// Output
// https://root.ly/1234

Liquid built-in

Was this page helpful?