- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2019 08:40 AM
Hi All,
I want to hide attachments on incident form for end users if it is added by ITIL users/ any role users,
But still end users can attach the attachments and they can manage the attachments which are attached by end users.
Thanks in advance.!!!
Thanks,
Rajashekhar Mushke
Community Leader
Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2019 09:31 AM
Sample Script:
before query business rule on sys_attachment table.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if (!gs.hasRole('itil') && gs.getSession().isInteractive()) {
var u = gs.getUserName();
var q = current.addQuery('sys_created_by', u);
q.addOrCondition('sys_updated_by', u);
gs.log('query restricted for user: ' + u);
}
})(current, previous);
you try something like this .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2019 11:15 AM
Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2021 05:39 AM
Hello Harsh
i have a similar requirement for Security incidents where we are enabling end users to create there attachments from Service portal, however we need to restrict the attachments added by security analysts on the Security incidents, there is an attachment generated for post incident report which we do not wish to show to end users. How can i restrict this,
I tried using Before query BR as below and seems not to be working:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if (!gs.hasRole('sn_si_analyst') &&(current.table_name == 'sn_si_incident') && gs.getSession().isInteractive()) {
var usr = gs.getUserName();
var cur = current.addQuery('sys_created_by', usr);
cur.addOrCondition('sys_updated_by', usr);
gs.log('query restricted for user: ' + usr);
}
})(current, previous);
Can you please help me how can i do it and what i am doing wrong? if i dont use table name in the if statement as marked in red above it works, but then it works for all tables which is not desired?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2021 03:26 AM
Hello Harshvardhan,
Can you please help on the below query.