Condition Builder in UI page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2020 08:26 AM
Hi All
I am trying to add a condition type field in ui page.
I used the page https://community.servicenow.com/community?id=community_question&sys_id=d52d43a9db9cdbc01dcaf3231f96... for my set up.
I see the alert on client side to get the condition field value and it works.
But how do I fetch it in the processing script?
Please help
Thanks
Surya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2020 11:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2020 11:47 PM
Hi Surya,
Can you share your code here?
I think you are referring that you are able to get the condition field value in client script and want it in processing script?
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
05-31-2020 09:45 PM
Hi Ankur,
This is the script
HTML
<g:ui_form>
<input type="hidden" id="cancelled" name="cancelled" value="false"/>
<table width="100%" cellpadding="0" cellspacing="0">
<g:ui_element table="sys_script" field="collection" id="6d5f3906db011010140a7b60399619fc"></g:ui_element>
<g:ui_element table="sys_script" field="filter_condition" name ="filter_condition" id="8c9e7dc2db011010140a7b60399619f9"></g:ui_element>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr><td align="left" nowrap="true"><br /><g:dialog_buttons_ok_cancel ok="return validateForm();" cancel="return onCancel();"/></td></tr>
</table>
</g:ui_form>
<script>
addLoadEvent( function() {
document.getElementById("sys_script.collection").value = "sys_user";
document.getElementById("select2-chosen-1").innerHTML = "sys_user [sys_user]";
//document.getElementById("s2id_sys_script.collection").hide();
loadFilterColumns('sys_script.filter_condition', 'collection');
});
Client script
addLoadEvent( function() {
document.getElementById("sys_script.collection").value = "sys_user";
document.getElementById("select2-chosen-1").innerHTML = "sys_user [sys_user]";
//document.getElementById("s2id_sys_script.collection").hide();
loadFilterColumns('sys_script.filter_condition', 'collection');
});
function validateForm() {
var m= alert(getFilter('sys_script.filter_condition'));}
Through this last line I get the condition builder entered. What i want is to redirect to all records with same condition builder so I wanted the processing script. Or if there is anyother way i can redirect to a list of records with the entered condition will also work.
Thanks
Surya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2020 10:08 PM
Hi Surya,
Can you share the HTML section and client script separately?
the addLoadEvent is present in html or client script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader