Hello dear friends,
I'm stuck on groovy development about boards (rapid views), and more precisely on swimlanes.
I'm trying to add programmatically a new swimlane in my board.
For this, I found these classes:
Here is my current code (it doesn't work at all):
import com.atlassian.greenhopper.model.rapid.RapidView
import com.atlassian.greenhopper.model.rapid.Swimlane
import com.atlassian.greenhopper.model.rapid.Swimlane.SwimlaneBuilder
import com.atlassian.greenhopper.service.rapid.view.RapidViewService
import com.atlassian.greenhopper.service.rapid.view.SwimlaneService
import com.atlassian.greenhopper.service.rapid.view.SwimlaneServiceImpl
import com.atlassian.jira.bc.JiraServiceContextImpl
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean
@JiraAgileBean
RapidViewService rapidViewService
def authenticationContext = ComponentAccessor.jiraAuthenticationContext
def user = authenticationContext.loggedInUser
def view = rapidViewService.getRapidView(user, 11014).get() // ID of board - you can see that in the URL
def swimlaneService = new SwimlaneServiceImpl()
log.debug swimlaneService;
log.debug view
allSwims = swimlaneService.loadSwimlanes(view)
for (swim in allSwims){
log.debug swim.toString()
}
def newSwimBuilder = new SwimlaneBuilder()
newSwimBuilder.name("New swimlane")
newSwimBuilder.query("'parent link' = KEY-1")
newSwimBuilder.position(2 as Integer)
def newSwim = newSwimBuilder.build()
log.debug newSwim.getId()
log.debug newSwim.getName()
log.debug newSwim.getQuery()
log.debug newSwim.getPosition()
swimlaneService.add(user, view, newSwim)
Honestly, ...
1. I found how to instantiate "rapidViewService" and it works, but I don't even understand how and why, first time I see this "@JiraAgileBean"... But nevermind. It works. But if you have time to explain to me what is this...
2. With SwimlaneService, I have the following error, after trying to access all swimlanes (loadSwimlanes(RapidView)) and I don't know why:
2022-07-22 16:11:20,224 ERROR [common.UserScriptEndpoint]: Script console script failed: java.lang.NullPointerException at com.atlassian.greenhopper.service.rapid.view.SwimlaneServiceImpl.loadSwimlanes(SwimlaneServiceImpl.java:84)
3. I found the "SwimlaneBuilder" and i can populate some fields (name, query...) but I don't know how to save it (and then, how to have a valid id for this new swimlane).
I'm pretty far from my goal.
Please, help me if you can!
Thank you so much <3 love on you.
Oliv'
Ah, from memory, the SOAP interface never gave you the estimate stuff. You either have to write your own add-on to expose it, or upgrade to using REST
Ok, this explain why I didn't find the value.
So, I will try another way to find my estimate stuff.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I havn't used Soap for this puporse, but I assume it would be similar to making rest call.
In rest you simply get an issue by passing its ID.
[GetIssueByID() | https://jira.pk-lhr.u-blox.net/plugins/servlet/restbrowser#/resource/api-2-issue-issueidorkey]
And then just access the remainingEstimate value from the JSON reply.
I see there are similar methods in Soap as well.
[getIssue Soap | https://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/JiraSoapService.html#getIssue(java.lang.String, java.lang.String)]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, but unforunately, there is no remaining estimate inside the SOAP "getIssue" reply.
That's why I ask for the knowledge of community.
The only things inside "getIssue" are the following :
object(stdClass)[224]
public 'id' => string '872800' (length=6)
public 'affectsVersions' =>
array (size=0)
empty
public 'assignee' => string 'mylogin' (length=9)
public 'attachmentNames' =>
array (size=0)
empty
public 'components' =>
array (size=0)
empty
public 'created' => string '2017-08-11T12:37:00.000Z' (length=24)
public 'customFieldValues' =>
array (size=6)
...
public 'description' => string 'soap test' (length=9)
public 'duedate' => null
public 'environment' => null
public 'fixVersions' =>
array (size=0)
empty
public 'key' => string 'TCN-3747' (length=8)
public 'priority' => string '9' (length=1)
public 'project' => string 'TCN' (length=3)
public 'reporter' => string 'mylogin' (length=9)
public 'resolution' => null
public 'status' => string '1' (length=1)
public 'summary' => string 'Test to be delete on sept 2017' (length=34)
public 'type' => string '3' (length=1)
public 'updated' => string '2017-08-24T06:14:08.000Z' (length=24)
public 'votes' => int 0
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.