- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2018 06:45 AM
Hi all!
I am trying to only show the sc_task related list on sc_req_item forms when the item is (this || that). The script is working when I remove the or condition and only have the one condition in the 'if' statement but when I add the || to the script, it doesn't work for either of the two items that I am trying to show the related list on. Here is my script:
Any feedback would be greatly appreciated! I have also tried the if statement like this:
function onLoad() {
var item = g_form.getValue('cat_item');
if (item != '//sys_id of item 1' || item != '//sys_id of item 2'){
g_form.hideRelatedList('sc_task.request_item');
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2018 07:46 AM
Please try below script.
var item = g_form.getValue('cat_item');
//alert(item);
if ((item == 'sysid') || (item == 'sysid')) {
g_form.showRelatedList('sc_task.request_item');
}
else
{
g_form.hideRelatedList('sc_task.request_item')
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2018 10:04 AM
Are the Catalog Tasks automatically created by a business rule or workflow? If so, it might be a better idea to modify the List Control to hide the related list if there are no catalog tasks. This way, you won't need to go back and modify your client script each time you want the related list to appear for more items.
This method won't work if these Catalog Tasks are created manually by your users, however.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2018 07:46 AM
Please try below script.
var item = g_form.getValue('cat_item');
//alert(item);
if ((item == 'sysid') || (item == 'sysid')) {
g_form.showRelatedList('sc_task.request_item');
}
else
{
g_form.hideRelatedList('sc_task.request_item')
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2018 09:51 AM
Beautiful! Thank you so much. This works perfectly. 🙂