Skip to main content

Require a Minimum Number of Attachments

Attachment4me UI extensions now provide the ability to determine the number of files that are attached to a record before this record is saved. This can be accomplished with the following JavaScript in a UI extension:

ITRP.field(‘attachment’).size()

The JavaScript example below prevents someone in 4me Self Service from submitting a request without adding at least 3 attachments:

$(‘#save’).on(‘click’, function(e) {
  if (ITRP.field(‘attachment’).size() < 3) {
    // at least 3 attachments
    e.stopImmediatePropagation();
    // prevents save action
    // do something, show alert or error message
  }
});