- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2021 12:07 PM
Change tickets are created from record producer. User attaches a word doc and that carries to the change ticket. User must not be able to edit/remove the attached file on change ticket. This is only on some change requests.
How to do this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2021 07:24 AM
This works quite nice to set the internal can_write_to_record (sys_attachment) to false which hides all of the buttons, so the previous 2 changes are no longer needed. Add in the HTML field, line 63 just before this line
<j:if test="${jvar_attachment_disabled == 'true'}" >
<!-- If Firewall Change request, disable adding or removing attachments. -->
<g:evaluate var="jvar_attachment_disabled" jelly="true">
var cr = new GlideRecord(jelly.jvar_target_table);
cr.addQuery('sys_id', jelly.jvar_target_sys_id);
cr.addQuery('short_description', 'CONTAINS', 'Firewall Change');
cr.query();
cr.next();
</g:evaluate>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2021 04:00 PM
Hi Brad,
I had to add two more criteria to enable buttons on Firewall Change.
I added the below scripts, jvar_admin part works. jvar_networkservicesteam does not work. Can you help me here?
<!-- If Admin, enable adding and removing attachments. -->
<g:evaluate var="jvar_admin">
var isAdmin = false;
if(gs.hasRole('admin'))
isAdmin = true;
isAdmin;
</g:evaluate>
<!-- If Network Services Team, enable adding and removing attachments. -->
<g:evaluate var="jvar_networkservicesteam">
var isNetworkServicesTeam = false;
if(gs.getUserID().isMemberOf('Network Services Team'))
isNetworkServicesTeam = true;
isNetworkServicesTeam;
</g:evaluate>
<j:if test="${jvar_attachment_disabled == 'true'}">
<j:if test="${jvar_networkservicesteam == 'true' || jvar_admin == 'true'}">
<j:set var="jvar_can_write_to_record" value='true' />
<j:set var="jvar_can_add_attachments" value="true" />
<j:set var="jvar_can_edit_attachments" value="true" />
</j:if>
</j:if>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2021 04:23 PM
You definitely need to pass in the group sys_id instead of the name in the isMemberOf function. Also, the full usage I've always seen follows the format
gs.getUser().getUserByID().isMemberOf('sys_id of group')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2021 08:21 AM
Still not working.
gs.getUser().getUserByID().isMemberOf('sysid') is returning null.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2021 08:28 AM
I had to do this gs.getUser().isMemberOf('sys_id') then it worked!
Thanks for all your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2021 08:55 AM
Hi Brad,
I have the similar query and implementing this is not helping since I want the add attachments functionality, but want to only disable the Remove button.
I tried implementing the previous two updates to HTML and Client Script codes but seems like it says that attachments can not be deleted for this change, but once clicked on Ok , it still enables the Remove button and I could remove attachments selected from Change.
Could you please help me on this?
Thanks,
Sumana