I'm attempting to use a ScriptRunner/Groovy script to give me a list of active and open (in progress & future) sprints in a specific board. For some reason, whenever I use the getSprintsForView() method, it fails and errors "cannot invoke method getSprintsForView() on null object".
The odd thing is that I check if the view is null, and the view seems to work just fine with other methods (like getOpenSprintsAndBacklogProjects.
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.greenhopper.service.rapid.view.RapidViewService;
import com.atlassian.greenhopper.service.rapid.RapidViewQueryService;
import com.atlassian.greenhopper.model.rapid.RapidView;
import com.atlassian.greenhopper.service.sprint.Sprint;
import com.atlassian.greenhopper.service.sprint.SprintManager;
def sprintManager = ComponentAccessor.getOSGiComponentInstanceOfType(SprintManager.class);
def rapidViewService = ComponentAccessor.getOSGiComponentInstanceOfType(RapidViewService.class);
def rapidViewQueryService = ComponentAccessor.getOSGiComponentInstanceOfType(RapidViewQueryService.class);
board_id = 89L;
def sprints = [];
def sprints_two = [];
def view = rapidViewService.getRapidView(user, board_id).getValue();
if (view != null)
{
sprints = rapidViewQueryService.getOpenSprintsAndBacklogProjects(user, view).getValue().left();
sprints_two = sprintManager.getSprintsForView(view).getValue();
}
What am I doing wrong?
Hi @Sidney Ambrose Welcome to Atlassian Community!
Kindly use the method suggested in this link :- https://mraddon.blog/2018/02/25/how-to-set-a-default-description-template-in-your-jira-tickets/amp/
Hope it works for you!
Thanks
V.Y
Kindly paste script at Initialiser
https://scriptrunner.adaptavist.com/5.6.8/jira/behaviours-overview.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vikrant,
Thank you so much for the assistance. It worked when we had the script in initializer.
Regards,
Sidney
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great, Glad to hear it works for you :)
Kindly accept the solution, if solution works for you so that it helps others users having same query.
Thanks
V.Y
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Vikrant Yadav , the method suggested also works for jira cloud ?
https://mraddon.blog/2018/02/25/how-to-set-a-default-description-template-in-your-jira-tickets/amp/
Thank for your help.
C.T.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Charlie This method is for JIRA Server and JIRA DC version. For JIRA Cloud, this doesn't work.
For jira colud, you can create Custom field and set Default value of that field.
Thanks
Vikrant Yadav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.