hide or show a related list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2017 01:26 PM
I have a requirement on Incident table to hide or show a related list. I have introduced a new choice field on Incident - BreakGlass which has choices Yes or No. Also I have a Related list on Incident i.e BreakGlassRequests which lists all break glass requests done for that incident. What should happen is untill I take Yes in BreakGlass field the BreakGalssRequests related should be hidden. I tried this function onCondition() { g_form.showRelatedList(BreakGlassRequests); } in UI policies in SCripts but thats not working. Can some one help me with this?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2017 01:58 PM
Hi Ravi,
Try with a Onchange client script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var myValue = g_form.getValue('Break_glass');
if(myValue == 'true'){
g_form.showRelatedList("BreakGlassRequests");
}else{
g_form.hideRelatedList("BreakGlassRequests");
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2017 03:11 PM
Hello Ravi,
Here you go.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
var brkGlass = g_form.getValue('u_break_glass'); //Assuming u_break_glass is the exact column value
if(brkGlass == 'yes'){ //Replace yes with the exact choice value of the field breadk glass
g_form.showRelatedList("BreakGlassRequests"); //Make sure you pass the name of the related list
}else{
g_form.hideRelatedList("BreakGlassRequests"); //Make sure you pass the name of the related list
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2017 01:33 AM
No mates, both the scripts doesn't seem to be working. If I go to the Incident form initially the BreakGlassRequests will be Off. As soon as I create a record it will appear. Now ideally when I toggle the choice to Yes the breakglassRequests related list should appear and when I toggle it to NO it should disappear
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2017 02:23 AM
Just a correction in the screenshot. In the field I have made it BreakGlass. Also I have put the alert messages in few places. But still the BreakGlassRequests tab behaves the same way. Once I create a record it will be ON and if I change it to NO even it remains ON. No clue whats happening here.