- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 09:44 PM
hi guys
i want to populate my location value in a drop down from location table and on click of submit i want to select that value so would you pls share jelly script for this..
thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2015 07:01 AM
Hi Mithlesh,
Since you are asking for jelly script I hope you are trying this in a UI Macro or UI Page. For pulling values from database and load the drop-down options see below code in bold.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_location" object="true">
var location = new GlideRecord('cmn_location');
//location.addQuery('country','USA'); //Give the query filter condition if any as per your requirement
location.query();
location;
</g:evaluate>
<select id="location">
<option value="">-- None --</option>
<j:while test="${jvar_location.next()}">
<option value="${jvar_location.getValue('name')}">${jvar_location.getValue('name')}</option>
</j:while>
</select>
</j:jelly>
And you also mentioned that you want to select the value on Submit. In case if you using this macro in a catalog item form, you can do that from an onSubmit catalog client script on the relevant catalog item level.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2019 10:49 PM
Have you got any solution for reference field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2015 07:02 AM
In there there's various combo box, but in particular the following code should be helpful:
<g2:evaluate>
var views = new GlideRecord('map_view');
views.orderBy('name');
views.query();
</g2:evaluate>
<tr>
<td nowrap="nowrap" align="right">
<label for="map_ciview">${gs.getMessage('View')}:</label>
</td>
<td>
<select name='map_ciview' id='map_ciview' style='width: 200px; overflow: auto;'>
<option value=''> ${gs.getMessage('All')} </option>
<j2:while test="$[views.next()]">
<g2:evaluate>
var viewHasRole = false;
var roles = views.roles.split(',');
if (roles.length != 0) {
for (var i=0; i != roles.length; i++) {
if (gs.hasRole(roles[i])) {
viewHasRole = true;
break;
}
}
}
else
viewHasRole = true;
</g2:evaluate>
<j2:if test="$[viewHasRole]">
<option value='$[views.sys_id]'> $[views.getValue("name")]</option>
</j2:if>
</j2:while>
</select>
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2015 07:00 AM
i have one more dout i want to set a reference field on my custom table from my location table ..means the value which select from drop down its should update in my custom table column which is a reference field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2015 06:49 AM
Hi Mithlesh,
In this case, when you populate the options for your drop-down give the sys_id as value instead of name of the location. So that you easily get the selected value and map it to your custom table field refering to location table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2015 08:37 PM
Hi, just out of curiosity, is your UI page some sort of maintenance window for records of a table?
Thanks,
Berny