Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Not able to use String function with Smart Value in lookup object

Hi Team,

I got one requirement from customer for insight object, they have one Object Schema In that they are creating object they want once any object got created field AssetID value should be automatically increment by one in the last Object AssetID

Let's take one example here

Object Key    AssetID  

LAB-123        ABC001

LAB-124        ABC002

LAB-125        ABC003

So the field AssetID value should be automatically added, so I am using Automation in JSM

Here is the details about the configuration :

When: Object Created

Then :  Lookup objects

insight query language is  

objectType = TEST ORDER BY AssetIDD DESC

here AssetIDD is text field

Then : edit Object

Select field : AssetIDD

Value : {{lookupObjects.get(1).temp_Asset_ID.charAt(2)}}

ERROR:

Edit Insight field attributes

 

Error updating Object(s)
Objects were skipped
LAB-6858 (temp_Asset_ID = '')

So this is the configuration I have  added but I can see all the text function is not working here and getting always empty value and in Automation audit log I can see error, I can achieve same requirement If I am using only number field but with text field no smart value function is working

following this document : smart-values-text-fields 

Any suggestion why my text function are not working ?

 

Thanks,

Sarika Dalal

2 answers

Hi @Sarika Dalal 

First thing, I do not have Jira Service Desk, so I will try to help based on what I see in your automation rule.

  • Is temp_Asset_ID a defined field in that lookup, as it may not be present if it is returning as empty?
  • For {{lookupObjects.get(1)... I believe this is trying to return the second item in the list, as these are 0-base indexed.  Is that what you want?  Otherwise if you want the first one, perhaps try: {{lookupObjects.first...
  • Your AssetID values are of the format ABC001, and you are trying to access at charAt(2).  According to the documentation, this one is 1-base indexed, so this may not be what you want.  Consider writing the values to the audit log to confirm what is happening.
  • And, as your AssetID values are alphanumeric, if you are trying to increment with a rule, wouldn't you need to split that value into the alpha and numeric parts, increment, and then concatenate the result?

Kind regards,
Bill

Thank you for the response @Bill Sheboy .

let me add few more points here :-

when I am trying {{lookupObjects.get(1).temp_Asset_ID}} its giving me value of the field after that I am using function {{lookupObjects.get(1).temp_Asset_ID.charAt(2)}} that is not working. with charAt function I am just testing String functions.

Issue is all string functions is not working here and every time I am getting null response.

Your thought is correct about point 4 I am going to split number and text field value only and then I will do increment in number.

 

Regards,

Sarika Dalal

You are using Cloud, correct?  If so, perhaps do this in two steps to force the type conversion to string:

  • create a variable and set the value to the temp_Asset_ID
  • then perform the charAt() on the variable

I recall needing to do this for other fields which are dynamically generated before I could use them in expressions.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

113 views 1 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you