Skip to main content

Require an Attachment

UI ExtensionTo ensure that end-users provide all information necessary to complete a specific type of request, support organizations add UI extensions to their request templates. These UI extensions deliver the fields that need to be filled out by the requester. Making these fields required ensures that the requester does not forget to fill them out.

But what if the support organization requires the requester to include an attachment? To request a security badge, for example, a digital picture may need to be attached to the request.

Making it mandatory to include an attachment now only takes a few mouse clicks, thanks to a new snippet that can be used to add the necessary JavaScript to the UI extension.

  
The result in Self Service is that the ‘Attach file…’ link is highlighted in blue and that the new request cannot be saved until an attachment has been added to the request.


This feature can also be used to for tasks. For example when test results need to be attached before approving a new application release, it is helpful when the approver cannot accidentally forget this.


Approval tasks should only need an attachment after they have been assigned to an approver. So for approval tasks it is best to refine the JavaScript code as follows:

if (4me.record.initialValues.get('status') === 'assigned') {
4me.field('attachment').required();
}