Groovy Script iql method

Crystal Rouse
Contributor
February 17, 2023

I'm looking for information on how to split a string.

This method used to work and return the value that I can use to query our Asset Schema:

def hardwareAssetKeyAbrv = hardwareAsset.toString().substring(hardwareAsset.toString().indexOf("(") + 1).replace(")","").replace("[","").replace("]","");

Something has changed, it now returns the key but also additional text so that the results look like: referenceId=115937
I don't know why the text referenceID= is included in the results, this is something new that changed from November to now.  The same script worked in November and now does not work.
I need the variable to only return the key, not the extra text.  I'm new to groovy script and picking up on code wrote by someone else.  Any help appreciated!

1 answer

0 votes
Payne
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.
February 17, 2023

Just guessing here, but something for you to try ...

def hardwareAssetKeyAbrv = hardwareAsset.getId();

Suggest an answer

Log in or Sign up to answer