- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 01:38 AM
i am passing value from client side to ui page like below.
var gdw = new GlideDialogWindow('ui page');
gdw.setSize(750, 300);
gdw.setPreference('abc',g_form.getValue('abc')); // abc is choice value
gdw.setPreference('xyz',g_form.getValue('xyz')); // xyz is datetime value
gdw.render();
Ui Page code
<select id="xyz" name="xyz" >
<g:options choiceList="${choiceList}" />
</select>
<g:evaluate var="abc" expression="RP.getWindowProperties().abc"/>
<g:ui_date_time name="DateTime" field='abc' value="${abc}"/>
Date is not populating but when i tried with gs.getDateTime() then its working withn current date.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 08:18 AM
Hi @Suman7 ,
To set the choice list use code like below. You can take reference from OOB ui page "edit_link_popup".
<g:evaluate> var relTypes = new GlideRecord('cmdb_rel_type'); // replace with your table relTypes.orderBy('parent_descriptor'); relTypes.query(); </g:evaluate> <select id='select_relationship_type'> <j:while test="${relTypes.next()}"> <j:choose> <j:when test="${relTypes.sys_id==${RP.getWindowProperties().get('xyz')}}"> <option value="${relTypes.sys_id}" selected="selected">${relTypes.name}</option> // replace with your field name </j:when> <j:otherwise> <option value="${relTypes.sys_id}">${relTypes.name}</option> </j:otherwise> </j:choose> </j:while> </select>
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 06:16 AM
Seems a duplicate question. I answered it here
How to set dateTime & choice value in UI page
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 08:18 AM
Hi @Suman7 ,
To set the choice list use code like below. You can take reference from OOB ui page "edit_link_popup".
<g:evaluate> var relTypes = new GlideRecord('cmdb_rel_type'); // replace with your table relTypes.orderBy('parent_descriptor'); relTypes.query(); </g:evaluate> <select id='select_relationship_type'> <j:while test="${relTypes.next()}"> <j:choose> <j:when test="${relTypes.sys_id==${RP.getWindowProperties().get('xyz')}}"> <option value="${relTypes.sys_id}" selected="selected">${relTypes.name}</option> // replace with your field name </j:when> <j:otherwise> <option value="${relTypes.sys_id}">${relTypes.name}</option> </j:otherwise> </j:choose> </j:while> </select>
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2024 07:46 AM
Thankyou @Runjay Patel.