- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2022 09:32 AM
Hi All,
we need to hide attachments to callers only for records related to a specific category on the incident table.
For example: If the incident category is "Hardware", then attachments added by operators on the incident must be hidden for the caller.
If the incident category is "Software", then attachments added by operators on the incident must be visible to callers.
We have noticed that there is a "Table_sys_id" field on the "sys_attachment" table that identifies which record the attachment was added to, but we cannot use it to retrieve the incident category.
Do you have any suggestions?
thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2022 08:49 AM
Thank you very much for your reply.
Unfortunately, applying this script generates an infinite loop which has slowed down the performance of the instance considerably.
To resolve our situation, we intervened directly on the portal widget that shows the Attachments to hide them from users.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2022 10:46 AM
Hi @Veronica
Can you try something like this:
Condition:
if (!gs.hasRole('itil') && gs.getSession().isInteractive())
Code:
(function executeRule(current, previous /*null when async*/ ) {
var grA = new GlideRecord("sys_attachment");
grA.addEncodedQuery("table_name=incident");
grA.query();
while (grA.next()) {
var gr = new GlideRecord("incident");
if (gr.get(grA.table_sys_id)) {
if (gr.category.getDisplayValue() == "Hardware") {
current.addQuery("sys_created_by", gs.getUserName());
}
}
}
})(current, previous);
It works, tested in my PDI but i feel ACL would be more prefarable rather than BR.
Thanks,
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2022 08:49 AM
Thank you very much for your reply.
Unfortunately, applying this script generates an infinite loop which has slowed down the performance of the instance considerably.
To resolve our situation, we intervened directly on the portal widget that shows the Attachments to hide them from users.