Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Splitting an Insight LookupObjects smart value - Jira Assets

Ahmad Sidawi
Contributor
July 5, 2023

Hi, 

 

I have a field in a Jira Assets/Insight schema which i'd like to split the value for. I've used the split in the past but in Asset fields its returning nothing.

We have something like XX12344-1234. I'd like to return the XX12344 only.

I've tried:

{{lookupObjects.first.id.split("-").first}}

 

the {{lookupObjects.first.id}} works fine, just the split doesn't return anything. 

 

Thanks :)

1 answer

1 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 5, 2023

Hi @Ahmad Sidawi 

First thing: I am not using Insights, and so I am basing my suggestion on what I know about automation rules.

I believe lookup objects is returning, well...an object.  That has structure to it and is not just text.  Perhaps try accessing the value attribute before the split, like this:

{{lookupObjects.first.id.value.split("-").first}}

or

{{lookupObjects.first.id.value.split("-").get(0)}}

Kind regards,
Bill

Ahmad Sidawi
Contributor
July 6, 2023

Neither worked unfortunately. They work fine with lookupIssues but don't seem to work with lookupObjects. Logs returned no result

 Screenshot 2023-07-06 081415.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2023

I wonder if the dynamic nature of assets and lookup objects is preventing this, similar to what happens for calculated fields with marketplace addons.

Let's try a work-around:

  • with a Create Variable action, save the value {{lookupObjects.first.id}} and let's name that varFirstId
  • write that to the audit log to confirm it worked
  • now let's try the split with {{varFirstId.split("-")}}

Saving the object to a variable will both look it up and force it to text.  And, writing it to the log will confirm it contains what you expected before we try other things.

Like John Isherwood likes this
Ahmad Sidawi
Contributor
July 6, 2023

That worked! What a pain ;P. 

 

Thank you so much 💛

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events