- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2020 03:34 AM
Hi guys,
I have the following script:
HTML:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<table>
<tr>
<td >Source</td>
<td><g:ui_reference id="source" name="source" table="itfm_cost_model" completer="AJAXTableCompleter" query="active=true" onChange="setUserFilter()" /></td>
</tr>
<tr>
<td>Target</td>
<td><g:ui_reference id="target" name="target" table="itfm_cost_model" completer="AJAXTableCompleter"/></td>
</tr>
</table>
</j:jelly>
Client Script:
function setUserFilter() {
document.getElementById('sys_display.target').value = '';
document.getElementById('target').value = '';
var sysIDSource = gel('source').value;
var UserLookUp = gel('lookup.target');
var array = [];
var gr = new GlideRecord("itfm_cost_model");
gr.addQuery("sys_id", "!=", sysIDSource);
//gr.addQuery('company.name', 'ACME Germany');
gr.query();
while(gr.next()) {
array.push(gr.sys_id.toString());
}
UserLookUp.setAttribute('onclick',"mousePositionSave(event); reflistOpen( 'target', 'not', 'itfm_cost_model', '', 'false','QUERY:active=true', 'sys_idIN" + array+ "', '')");
}
I have tried with lines 2 and 3 in Client Script but it does not work. I need when user select different option in "Source", the "Target" field is cleared.
Thanks!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2020 03:52 AM
Hi,
please check this
How to clear value of g:ui_reference box in UI Page when user select different option?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2022 03:44 AM
H
I tried the same. But I am selecting the option nothing is coming. It is clearing the value without changing the option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2024 09:10 AM
Hi Ankur,
can i anyhow get the number of records that's loaded in g:ui_reference field.
any help appreciated.