- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 07:33 AM
I have a client script that hides multiple parts of a form. It's HR Case but I think my question is more universal. Right now I have a section that looks like
g_form.hideRelatedList('REL:b65330019f22120047a2d126c42e70f2');
g_form.hideRelatedList('REL:f6d4f37d2f031200b3c9a310c18c95a3');
g_form.hideRelatedList('sn_hr_core_case.parent');
g_form.hideRelatedList('REL:765330019f22120047a2d126c42e70f2');
g_form.setSectionDisplay('case_history', false);
g_form.setSectionDisplay('customer_communications', false);
I'm still learning coding. I want to add the attachment area so its hidden by the same event. I know that it lives in 'header_attachment'.
How do I translate that to the g_form format I have?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 08:40 AM
Not sure why you want to do this, and I'm not recommending this as best practice, but this an On Load Client script as per below will do the trick:
function onLoad() {
document.getElementById('header_attachment').style.display = 'none';
document.getElementById('header_attachment_line').style.display = 'none';
}
also on your client script, you need to set the Isolate script field to false (since London release). This field is not found on the form layout OOTB, you will need to add it. Once this field is unchecked, your script should work.
Regards
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 08:40 AM
Not sure why you want to do this, and I'm not recommending this as best practice, but this an On Load Client script as per below will do the trick:
function onLoad() {
document.getElementById('header_attachment').style.display = 'none';
document.getElementById('header_attachment_line').style.display = 'none';
}
also on your client script, you need to set the Isolate script field to false (since London release). This field is not found on the form layout OOTB, you will need to add it. Once this field is unchecked, your script should work.
Regards
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 11:48 AM
Sorry for the lack of context. The whole script is
function onLoad() {
//alert(g_scratchpad.groups);
if(g_scratchpad.groups == true){
//if hide sections business rule evaluates to true then all related lists ans all sections are viewable.
g_form.showRelatedList('REL:b65330019f22120047a2d126c42e70f2');
g_form.showRelatedList('REL:f6d4f37d2f031200b3c9a310c18c95a3');
g_form.showRelatedList('sn_hr_core_case.parent');
g_form.showRelatedList('REL:765330019f22120047a2d126c42e70f2');
g_form.setSectionDisplay('case_history', true);
g_form.setSectionDisplay('customer_communications', true);
}
else{
//if hide sections business rule evaluates to false then all sections excludinf worknotes and all related lists will be hidden.
g_form.hideRelatedList('REL:b65330019f22120047a2d126c42e70f2');
g_form.hideRelatedList('REL:f6d4f37d2f031200b3c9a310c18c95a3');
g_form.hideRelatedList('sn_hr_core_case.parent');
g_form.hideRelatedList('REL:765330019f22120047a2d126c42e70f2');
g_form.setSectionDisplay('case_history', false);
g_form.setSectionDisplay('customer_communications', false);
}
///There is an additional business rule that allows "Cases for Customer" related list to be available if it meets conditions.
}
Essentially we have some rules so if you are not in the assignment group you can only see part of the case. We want to add to that so you also cannot see any attachments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 01:16 PM
Ok makes sense, just add the two lines in my reply to the else and you should be good to go.
Regards
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 08:45 PM
Hi Paul, I tried this in my DEV environment and it works as expected in the platform in the sp view within the platform. I also display the sp view in the service portal however the header_attachment still shows in the service portal. Anyone know how to make it work in the Service Portal too? I have it currently set to global but it still does not hide in the portal. I have tried all 3 ui type options too
they are hidden in this view
But showing in the service portal
any assistance would be appreciated