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-18-2017 02:31 AM
Hi Ravi,
Since you are writing an On Change client Script, you need to select the correct field name which in your case should be "Break Glass" instead of Active as per your screen shot.
Have highlighted the portion where you need to select the correct field name and instead of using myValue as a variable you can directly use newValue as below:
Please modify your script as below:
Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
g_form.hideRelatedList("task_sla.task"); // Replace your Related List here instead of task_sla.task
return;
}
if(!g_form.isNewRecord())
{
if(newValue =='Yes')
{
g_form.showRelatedList("task_sla.task");
}
else if(newValue == 'No')
{
g_form.hideRelatedList("task_sla.task");
}
}
//Type appropriate comment here, and begin script below
}
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2017 11:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2017 12:02 PM
Hi,
Can you check your Related List Name(You need to pass the backend name of your Related LIst) and try the same code again. To check the Related List name follow the below steps:
1) Navigate to "Related List" module under System UI and search as Table=incident as shown below:
2) Open the Record with View as Default or the one in which your Related List is present.
3) Scroll Down and check the name of your Related List entries and copy the same and try the code again.
Above code shared is working for me as per your requirement.
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2017 10:49 PM
Shloke ! Mate you rock. This worked at last. Thanks for all your efforts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2017 11:14 PM
Awesome!!. Please mark the response as correct so that the thread can be closed and this question can be removed from the Unanswered List. Please find the below link on how to mark the answer as correct in community:
How To Mark Answers Correct From Community Inbox
Regards,
Shloke
Regards,
Shloke