[Structure Plugin] StructureServices.class in custom calculated field

Hello,

In Jira I created a custom calculated field that shows me the ID of a default structure of a particular issue. The code is as follows:

<!-- @@Formula:
    import com.atlassian.jira.component.ComponentAccessor;
 
    long id = 108;
    try {
       id = ComponentAccessor.getOSGiComponentInstanceOfType(
          com.almworks.jira.structure.api.StructureServices.class
       ).getStructureConfiguration().getDefaultStructureId(
             issueObject.getProjectObject()
       );
    } catch (Exception e) {}
    if (id == 1) id = 108;
    return id;
-->

After, in the structure I choose to view this custom field and it works fine (i.e. the value is calculated to each issue and there are any errors in the Jira log). But when I start Jira indexing in the log I get the following error:

Class: com.almworks.jira.structure.api.StructureServices not found in namespace : at Line: 7 :

 and in the opened structure suddenly the value ARE NOT calculated to each issue.

Why is this happening? Could anybody help me?

Thanks a lot in advance!

Vladimir

1 answer

1 accepted

This widget could not be displayed.

Hi Vladimir,

Sorry for delayed response. It looks like you are trying to use API for Structure 2.x. And I assume you are using some more contemporary version of Structure. Please, check the current javadoc: http://almworks.com/structure/javadoc/latest/

Regards,
Egor

ALM Works Support

Hello Egor,

Thank you for the answer. So, I use Structure 2.10.6 and Jira 6.4.11. Is this API compatible with this versions? If yes, what should I use instead of StructureServices.Class?

Best regard,

Vladimir

Hi Vladimir,

Sorry again, looks like we are actually facing the bug. We will have to look at the logs in depth, as 2.10.x should be compatible with that API. Would you be able to create a ticket in our Service Desk? We will be able to provide instructions for log collection there.

Sorry for inconvenience.

Regards,
Egor

ALM Works Support

Here, I just put information that this problem was solved. More information is here

https://support.almworks.com/servicedesk/customer/portal/8/ALM-2973

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted 16 hours ago in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

42 views 1 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you