
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2017 10:45 AM
Greetings Everyone!
I have a catalog item and have a classification Field( Variable) which is reference to custom table ( Classification). I have created a UI page in my Catalog Item with Group Roles and User ID.
Now, the Group Role is reference to Custom Table ( Group) which has Group Roles tagged to Classification above ( Only two Classification, A & B).
Now, My requirement is If I choose A in my Classification Field,Only the roles tagged to A should be listed in my Group Role Field and If Chosen B, the roles that are tagged to B should be listed in my Group Role reference field.
I have tried different option but no luck. Please let me know if there is something way we can achieve my requirement.
My HTML Code:
<TD><g:ui_reference name="group_role" query="u_classification=u_pgm_classification.value" id="Group_Role" table="u_pgm_group_role" completer="AJAXTableCompleter" columns="u_group_role" /></TD>
<TD><g:ui_reference name="ln_user" query="active=true^u_employee_type=SAPHR" id="ln_user" table="sys_user" completer="AJAXTableCompleter" columns="user_name" /></TD>
Corresponding Client Script:
var root = document.getElementById(r);
var allRows = root.getElementsByTagName('tr');
var cRow = allRows[1].cloneNode(true);
var j = 0;
for (j = 0; j < cRow.cells.length; j++) {
if(j>0 && j!=4){
document.getElementById('fn_user').value = '';
document.getElementById('sys_display.fn_user').value = '';
document.getElementById('ln_user').value = '';
document.getElementById('ln_user').name = '';
document.getElementById('sys_display.ln_user').value = '';
}
}
root.appendChild(cRow);
}
function deleteRow(r) {
try {
var table = document.getElementById(r);
var rowCount = table.rows.length;
for(var i=0; i<rowCount; i++) {
var row = table.rows[i];
var chkbox = row.cells[0].childNodes[0];
if(rowCount>2){
if(null != chkbox && true == chkbox.checked) {
table.deleteRow(i);
rowCount--;
i--;
}
}
}
}
catch(e) {
alert(e);
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 08:20 AM
Hi Ankur,
Apologies for the delay in response. I tried in my personal instance and its not working as expected. Would you be able to check mine if I share my creds?
Pls confirm. I will mail the details..
Thanks
Shan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2017 11:04 AM
Hi Shankar,
Please find my comments to below questions which provides your answer. Update your code as per that
Reference field dependency on UI Page
How to make assigned_to field dependent on assignment group on a UI page
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
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
09-15-2017 11:43 AM
Hi Ankur,
Thanks for the response. I did refer your posts before this. But, the coding was bit confusing to me. I am trying to relate your codes to my current requirement and test.
Thanks
Shan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2017 11:52 AM
Hi Shankar,
Yes that's correct. In those posts I have given detail code as well. You can relate to that as per your need and let me know if any issue in achieving this requirement. it should be done as I have done and mentioned in those posts as well
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
09-15-2017 12:11 PM
Hi Ankur,
In your earlier Posts, the code is for two reference fields are in UI Page. So the code I tested didn't work.
My scenario is, the field is in my catalog item and the reference field in UI page has to list based on the Value we chose in Catalog Item variable.. Please help me with the code. Let me know if its confusing.. I can brief.