- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-21-2022 08:50 AM
Hi Team,
I have a requirement ,In SC_TASK table how can we hide Activities formatter field for Particular assignment group. i need to hide Highlighted part. i wrote Script include for
var GetAssignedToData = Class.create();
GetAssignedToData.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getAssignedTo: function() {
var sysID = this.getParameter('sysparm_sysID');
var g = new GlideRecord('sc_task');
g.addEncodedQuery('request_item.cat_item=189950c91b588d10a76243f0b24bcbfa^sys_id=' + sysID);
g.query();
if (g.next()) {
if (!gs.getUser().isMemberOf(g.assignment_group) && !gs.getUser().isMemberOf('Csir secure Group'))
return true;
else
return false;
}
},
i am hiding variables and varibale sets. i need to hide Highlighted part.Please help me to resolve my issue.Thank you in Advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-22-2022 12:35 AM
no direct method to hide that
You can either use view where that view won't have that activities filter and use view rule to show view based on your condition
But it won't happen on change of some field but only once when form loads
OR
you need to use DOM manipulation to show/hide it but DOM is not good practice
1) Ensure Isolate Script field is set to false for your client script
2) This field is not on form but from list make it false
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// ajax code here
document.getElementById('sn_form_inline_stream_entries').style.display = 'none'; // to hide
document.getElementById('sn_form_inline_stream_entries').style.display = ''; // to show
}
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
ā02-22-2022 03:12 AM
Hi Ankur,
I applied the same logic, now it is working as expected. But in my case i have one Business Rule
restricting the RITM's, when i activate the business rule catalog item fileld becomes empty then our
code is not working.
Business rule before Query
if(gs.getSession().isInteractive() && (!gs.getUser().isMemberOf('CSIR secure group') && !gs.getUser().isMemberOf('Csir non secure Group'))){
q=current.addEncodedQuery('cat_item.name!=Cyber Security Incident Form for Secure Group^cat_item.name!=Cyber Security Incident Form');
}
//Add the scenario if user is part of both the grops - If this is possible as per the current system
//RITM is visible to only CSIR secure group members - Secure Group admins
if ((gs.getSession().isInteractive() && gs.getUser().isMemberOf('CSIR secure group'))) {
}
//RITM is visible to all - Non secure group
if ((gs.getSession().isInteractive() && gs.getUser().isMemberOf('Csir non secure Group'))){
q=current.addEncodedQuery('cat_item.name!=Cyber Security Incident Form for Secure Group');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-22-2022 03:16 AM
Hi,
logic to show/hide is shared in my script.
Please ensure you use that and use valid conditions when it should be shown etc
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
ā12-26-2024 08:34 PM
can you please suggest how to hide Activities onLoad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-22-2022 07:39 AM
Hi Ankur,
Below code is used for hiding Activities in sc_task(which you suggest),it is working when my BR is inactive,
when I activate the BR(catalog item field gets empty in SC_task so hiding of the Activities is not working)
this is the
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-22-2022 08:07 AM
Could you please help me to resolve the issue