attachement field on form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2016 09:22 AM
Hi Guys
I was able to add an attachment using an annotation and the following inside
<div id="wrapper" style="color:#000000; line-height: 25%;height:0;text-align:left">
<a id="swamy.attachment" onclick="saveAttachment('incident', '${sys_id}');"><img src="images/icons/attachment.gifx" />Click here to add attachement</a>
</div>
My question is, can I now make this mandatory? Or is there any other way to add an attachment field onto the form/table?
Many thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2016 10:03 AM
Hi Brendan,
1.You can add a button in the form for attachment.
2.Please go through below thread if you want to make attachment mandatory.
Ability to make attachment as required field
Please mark it as Helpful/Correct according to its impact.
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2016 03:13 AM
Thank you Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2016 10:07 AM
When we have faced the challenge of making an attachment mandatory, we end up doing a work-around to see if they used the button. We look into the sys_attachment table to see if an attachment was uploaded to that record, by that user, and within a reasonable period of time. If we do not see anything attached that meets our criteria we do not allow the record to be saved. I consider this a work-around because it's not an exact science.
We do this because it's good enough for us - we acknowledge that there are certain scenarios it will not catch.
(There is a .hasAttachments check you can do, but that would fail if there were previously attachments on the record)
In thinking about it further, in context of your example, you could improve this by calling your own javascript function. Your javascript function would call the "saveAttachment" ServiceNow function (which I do not think we have access to), but after it has completed you could then set a flag to indicate an attachment was included. Once you save the record you would wipe out the value for your flag so that the next update is forced to include an attachment. This would ensure that the attachment button was clicked that session (rather than if they clicked it on an update that was a minute previous).
Another option, more intrusive, would be to make your own UI action for save/update. When the user clicks it they are forced to attach a file. If they do not attach a save, their record does not save. Not a fan because that's a pretty big customization and a user may be left with the impression the record saved when it didn't (as no one reads the popup warning you will display).
One additional method I do not know if it would would, is to use an onLoad client script and overwrite the "saveAttachment" function. Not sure how that would achieve anything more than my above suggestions, but it would clearly allow the most flexibility because it would intercept the "saveAttachment" call and allow you to do what you want.
Hope that gives you some ideas!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2016 03:13 AM
Thank you Trevor for taking the time