Forums

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

How to empty Integer Asset fields with legacy methods

tobias schachner
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 18, 2025

I'm using Asset Automations with Groovy Scripts as described here:
Assets - Update attribute value from a referenced object | Jira and Jira Service Management | Atlassian Support
How can I empty fields with Integer values.

Also: Is there a way to use newer methods, since some of the used methods are deprecated?msedge_mmPKCulE8k.png
This throws an Exception...

Kind regards.
Toby

1 answer

0 votes
Eugenio Onofre
Community Champion
May 1, 2025

Hi @tobias schachner

I’ve worked with Asset Automations and Groovy scripts in JSM, and yes, the documentation examples often use older (sometimes deprecated) methods, which can be a bit frustrating.

To clear the integer field, you can use:
object.setAttributeValue("Your Integer Attribute", null)

Just make sure the field is not required, otherwise this will throw a validation error.

About the deprecated functions, Atlassian has started encouraging use of newer, more structured methods via the Assets Java API, especially in Forge or ScriptRunner integrations, but in Asset Automations you're still limited to the older Groovy-based scripting environment.

👉 Best Practices:

  • Use object.setAttributeValue(attributeName, value) for now as it's still supported in the automation engine.
  • For complex operations or long-term maintainability, consider ScriptRunner for Assets, which gives access to more modern methods and structured querying via GraphQL or the newer Java Beans

Please remember to vote and accept this answer in case it helps you resolve your query.

Regards,
Eugenio

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events