You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hi Folks,
I have crated a picklist custom filed with Groovy script by using below custom template, am able to list out all the required values in picklist but not able to save/hold the selected specific value from the list if user perform any operations like page refresh or filling other values picklist displaying default/first value from the list,
Please find the below custom template lnline code
<p>
<select id="Planview Project Name">
$value
</select>
</p>
May i know how we can save/hold the specific value from the picklist. Thankyou in advance.
Could you provide a little more information, i.e. what have you used to configure your picklist? Is it Scripted Fields?
From the code that you have shared, it appears to be more of a javascript.
Could you please share the complete code you are currently using and a screenshot of your configuration so it can be reviewed?
Thank you and Kind regards,
Ram
Hi @Ram Kumar Aravindakshan _Adaptavist_ ,
Yes, I have configured Scripted Field with Groovy.
Based on my requirement want to display return values as a picklist/dropdown field and want to save selected value from the list at dashboard/issue creation.
i don't have any issue with source code and facing issue with custom template(picklist/Dropdown).
Below code for Advanced custom template return value(picklist/Dropdown).
<form>
<select id="Planview ProjectName">
<option selected disabled>--Select ProjectName--</option>
$value
</select>
<span class="overlay-icon throbber"></span>
<div class="save-options" tabindex="1"><button type="submit" class="aui-button submit" accesskey="s" title="Press Alt+s to submit this form" resolved=""><span class="aui-icon aui-icon-small aui-iconfont-success">Save</span></button><button type="cancel" class="aui-button cancel" accesskey="`" title="Press Alt+` to cancel" resolved=""><span class="aui-icon aui-icon-small aui-iconfont-close-dialog">Cancel</span></button></div>
</form>
Below is the source code to fetch the data by using API and list out json data by using for loop :-
import com.onresolve.scriptrunner.canned.jira.fields.model.PickerOption
import groovyx.net.http.ContentType
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.Method
import java.net.HttpURLConnection;
import net.sf.json.groovy.JsonSlurper
import net.sf.json.JSON;
import groovy.json.JsonBuilder
import java.util.TreeSet;
// Source code from below REST API
def get = "https://abc-planview-service.eu-gb.mybluemix.net/api/v2/projects?token=XXXXXXX".toURL().text
def json = new JsonSlurper().parseText(get)
def Name = json."name"
def result = ""
def sort = new TreeSet();
for (key_value in json) {
def Status_Value = key_value."status"
def BU_Value = key_value."bu"
def ProjectCategory_Value = key_value."projectCategory"
if (!((Status_Value == 'WBS20$CNCL') || (Status_Value == 'WBS20$CLOS') || (ProjectCategory_Value == "MVP Agile") || (BU_Value == "Property & Facilities Solutions")))
{
sort.add(key_value)
}
}
for (key_value in sort) {
result = result + "<option>"+key_value.name
}
return result
Please refer attached screenshots for reference and let me know if anything is needed
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.