Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Get object reference of ExtendedSystemInfoUtils

Hi Community,

How can I get object of ExtendedSystemInfoUtils in scriptrunner? ComponentAccessor is unable to get this component.

ComponentAccessor.getComponent(ExtendedSystemInfoUtils) is always null

Jirs api: https://docs.atlassian.com/software/jira/docs/api/7.1.4/com/atlassian/jira/util/system/ExtendedSystemInfoUtils.html

1 answer

1 accepted

1 vote
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 21, 2023

Hi @scriptIt

I ran a quick test in my environment and didn't encounter any issues.

If you observe the screenshot above, I can invoke the ExtendedSystemInfoUtils and access its methods:-

extendedSystem.png

To proceed, could you please clarify what version of Jira and ScriptRunner you are currently using?

I am looking forward to your feedback and clarification.

Thank you and Kind regards,

Ram

Hi @Ram Kumar Aravindakshan _Adaptavist_ ,

Thanks for your answer.

Jira version: 9.4.8

Scriptrunner version: 7.12

Output:
image.png

Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 21, 2023

Hi @scriptIt

Ok, so if you want to declare the ExtendedSystemInfoUtils object, you can't directly use the ComponentAccessor.  

Instead, you need to use the ComponentAccessor to invoke the I18nHelper object. Once you have invoked it, you need to pass it to the ExtendedSystemInfoUtils constructor as shown below:-

import com.atlassian.jira.util.I18nHelper
import com.atlassian.jira.util.system.ExtendedSystemInfoUtilsImpl
import com.atlassian.jira.component.ComponentAccessor

def i18nHelper = ComponentAccessor.getComponent(I18nHelper)
def extended = new ExtendedSystemInfoUtilsImpl(i18nHelper)

extended.usageStats

Below is a screenshot of the output returned:-

image1.png

If you observe the screenshot above, I can get the result.

I hope this helps to solve your question. :-)

Thank you and Kind regards,

Ram

Hi @Ram Kumar Aravindakshan _Adaptavist_ ,

This is perfect.

Thanks for your help :)

Suggest an answer

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

Atlassian Community Events