How to populate the list on selecting a specific type of project in tempo?

Ankini Shah February 3, 2020

Hello,

I am trying to populate the project name when a user selects the project type. For example, Project type is A, the dropdown box should list with project names that belong to project type A. Can anybody suggest how to write a script in the scriptrunner so that I can attached that link to work attributes in dynamic dropdown field.

Thanks

Ankini

3 answers

0 votes
Ankini Shah February 11, 2020

Hi @Chander Inguva

I checked your solution for "Connecting to External MS SQL Database from JIRA using Groovy SQL". It worked for me

 Can you please try to look at this issue and if you have any idea about this?

Looking forward to your response.

Thanks

Ankini

0 votes
carolyn french
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 5, 2020

Hi Ankini,

Can you provide screenshots and more details of what you are trying to do, and what you would like to see as an outcome of this? 

thanks,
Carolyn

Ankini Shah February 6, 2020

Hi @carolyn french 

Thanks for looking into my question. Here is the youtube link where I have screen recorded of our company's time tracker and the same thing we would like to replicate in tempo while logging time.

Link: https://youtu.be/K4qrhhR6_I0

So as you can see, we have project types R&D New, R&D Old, Support, etc and on select, those "Type", a list of projects populate under "Project" dropdown and in regards to that "Task" list populates. The same we would like to replicate under log time in tempo using the dynamic dropdown. Not sure exactly how I can do that. If you can guide me with that, it would be great.

Please let me know if you have any questions.

Thanks

Ankini

Ankini Shah February 11, 2020

Hi @carolyn french ,

Any updates with the question?

Looking forward to your response.

Thanks

Ankini 

carolyn french
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 12, 2020

Hi @Ankini Shah ,

Thanks for that youtube video explanation- clearer now.

Can you by any chance do this at the issue level instead of worklog level? 

Ankini Shah February 13, 2020

@carolyn french 

It is preferred to be done at the worklog level for the accounting purpose in our organization. Trying using script runner but no luck till now.

 

Thanks

Ankini

Ankini Shah February 25, 2020

Hi @carolyn french 

I tried using this script. But still getting "no results found" in the dropdown. Can you please give it a look. 

Under the logs section, I am getting null. So I believe something is wrong with issue and issueKey. Also, I have attached a screenshot showing that I am unable to get the data in my dropdown. Could you please help me here?

API URL:-http://jira.mjappliedtech.com:8100/rest/scriptrunner/latest/custom/tempoWorkType

 

import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonBuilder
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor
import javax.servlet.http.HttpServletRequest
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response

@BaseScript CustomEndpointDelegate delegate

def issueManager = ComponentAccessor.getIssueManager()

tempoWorkType(httpMethod: "GET") { MultivaluedMap queryParams, String body, HttpServletRequest request ->
def callbackFn = queryParams.getFirst("callback")
def issueKey = request.getParameter("issueKey")
def options
def issue = issueManager.getIssueObject(issueKey)

if(issueKey!= null){
options = [
values: [
[
key:"",
value:"Please select..."
],
[
key:"Dev",
value:"Development"
],
[
key:"Unit",
value:"Unit Testing"
],
[
key:"QA",
value:"QA Testing"
]
]
]
}
else{
options = [
values: [
[
key:"",
value:"Please select..."
],
[
key:"Err",
value:"Error in Dropdown"
],
[
key:"Issue",
value:"Not Receiving List"
]
]
]
}
def resp = """${callbackFn} ( ${new JsonBuilder(options).toPrettyString()} )""".toString()
return Response.ok(resp).build()
}

0 votes
Fernando Bordallo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 3, 2020

Interesting. @Maxime Nie [Tempo] , any ideas on this one?

Suggest an answer

Log in or Sign up to answer