- 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-02-2021 04:50 PM
Thank you so much. That worked really well.
Can you also help me with the Adding Attachments?
In the same UI Page, I am trying to modify the validateAttachment() function that takes care of adding attachments. The problem with this is, it shows the attachment popup and I try to attach, it does not allow me. Then, I try to close the attachment popup, then it gives me an alert "Close before uploding attachments?"
How to handle this?
function validateAttachment() {
var form = $('sys_attachment');
var fileFields = form.select('.attachmentRow');
if(attachmentParentTable == 'change_request'){
var chg = new GlideRecord(attachmentParentTable);
chg.addQuery('sys_id', attachmentParentSysId);
chg.addQuery('short_description', 'CONTAINS', 'Firewall Change');
chg.query();
if(chg.next()){
attachButton.disabled = "true";
alert('You cannot add attachments after Firewall Change Request is created');
return false;
}
else{
for (var i = 0; i < fileFields.size(); i++) {
if (fileFields[i] && fileFields[i].value != "") {
setAttachButton(""); //disable
$('please_wait').style.display = "";
return true;
}
}
alert("${JS:gs.getMessage('Choose a file to attach')}");
return false;
}
}
else {
for (var i = 0; i < fileFields.size(); i++) {
if (fileFields[i] && fileFields[i].value != "") {
setAttachButton(""); //disable
$('please_wait').style.display = "";
return true;
}
}
alert("${JS:gs.getMessage('Choose a file to attach')}");
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2021 04:53 PM
So you want to prohibit adding a new attachment under the same conditions (Firewall Change request)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2021 05:02 PM
- 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-03-2021 08:34 AM
Thank you so much Brad. That worked awesome!