Is it possible to re-use data from another script file in an Assets automation script?

Stefan Stadler
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.
December 10, 2024

Hi,

I am trying to write an automation for Assets, which will run actions on Jira once an object of a specific type is created.

For this, I am using a mapping, which is defined in a JiraConstants.groovy file, so that it can be used from multiple points in the instance.

Unfortunately, this is failing in case of Assets automation with "unable to resolve class" error.

I am using the following code: 

import com.my.package.JiraConstants

And this is where it is failing. I have added the location of the script to the allowed list already in the same way as the running script. As the running script is executed, I assume this is correct. However, an import of the constants class is failing, while other imports like org.slf4j.Logger are working fine.

Is there anything special to be done when using another script file in Assets automation scripts?

Thanks!

Stefan

1 answer

1 accepted

3 votes
Answer accepted
Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2024

Hi Stefan!

This is a common issue. The Asset Script runtime appears to be different from the one you use in Script console or Script editor. Therefor some classes are not available form Asset script console. I would solve this by storing these constants in Asset management somewhere, that way you will be able to access them form all script environments.

Jeroen

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.4.1
TAGS
AUG Leaders

Atlassian Community Events