- 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-21-2022 08:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-21-2022 10:32 AM
Hello,
You cannot directly hide an activity formatter based on condition using client script or business rule.
You need to create a new view with all the fields but do not add Activity Formatter in it.
Then write a view rule that for the particular group it should always redirect to the new view created and for others it will take the default view.
Please mark answer correct/helpful based on Impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-21-2022 11:46 PM
could you please help me to resolve this issue
- 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