Automate

 View Only
  • 1.  Tip of the Week - Attachment Control and how to make it mandatory

    Employee
    Posted yesterday
    Edited by Rishav Kumar yesterday

    The Attachment Control in Precisely Automate Evolve forms enables users to upload files as part of the form submissions. It's critical for processes requiring supporting documents like contracts, certificates, or compliance evidence. The documents attached to the form can also be uploaded to SAP.

    Overview

    • Allows single or multiple file uploads.
    • Supports common file types: PDF, DOCX, XLSX, images, etc.
    • Files are stored securely and linked to the workflow instance.


    Attachment Control Properties

    Property

    Description

    Allow Deletion

    Enables the deletion of files that have been uploaded previously.

    Allow Replacement

    Enables the replacement of files that have been uploaded previously. If set to false, the uploaded files cannot be replaced.

    Allow Update

    Enables the updating of files.

    Hide Existing

    Hides the attachments that have been uploaded previously.

    Include Inline

    Allows the attachments in the form to be displayed inline in the form.

    Require Review

    Requires that the user click the attachments and view them before proceeding.

    Maximum

    The maximum number of attachments that are required before the form can be submitted.

    Minimum

    The minimum number of attachments required for the form to be submitted.

    Message

    The message to display if the minimum or maximum requirement is not met.

    Inline Width

    Defines the width of the window in which the attachment is displayed. Used if Include Inline is set to true.

    Inline Height

    Defines the height of the window in which the attachment is displayed. Used if Include Inline is set to true.

    Attachment control also respects the following Configuration Options/Keys: 

    ·       AttachmentControlValidationType – Standard behavior searches the file name for known illegal characters, and then present an error if a file name contains those characters.

    Custom retrieves a regular expression from the AttachmentControlValidationRegExp key, and if that regular expression does not match the file name, presents the error to the end user.

    Important: The TYPE must be specified in lower case, i.e. standard or custom.

    ·       AttachmentControlValidationRegExp – Regular expression to use with custom Attachment Control validation. Defaults value is ^([a-zA-Z0-9_ ]+\.?)+$

    If you are using the Attachment Control Upload Document to SAP, then make sure the Attachment Control is part of Repeating Table (having FILE_BYTES column). Attachment Control to upload document to SAP cannot be placed outside Repeating Table, as binding of non-repeating and repeating field cannot be same, for example FILE_BYTES.

    Making Attachment Mandatory

    Example 1: Set a minimum of 1 and maximum of 4 attachments in the form.

    Set the value of property "Minimum" as 1

    Set the value of property "Maximum" value as 4

    Set the Message property as "Minimum 1 and Maximum 4 attachments are allowed"

     

    Example 2: Conditionally set the Attachment Control 'my:Attachment_1' to have a minimum of 1 attachment if the value of field  '/my:myFields/my:field_4' is X

    var ATTACHMENT_BINDING = 'my:Attachment_1';
    var CONTROLLING_FIELD_PATH = '/my:myFields/my:field_4';
    var REQUIRED_TRIGGER_VALUE = 'X';


    var fieldValue = $form.getValue(CONTROLLING_FIELD_PATH);


    if (fieldValue === REQUIRED_TRIGGER_VALUE)
    {

    SVFormInternalAttachmentValidations[ATTACHMENT_BINDING].minimum = 1;

    }


    Example 3: Conditionally set the Attachment Control 'my:Attachment_1' to have a minimum of 1 attachment if the value of field  '/my:myFields/my:field_4' is X, else set the minimum attachment value as 0. Also suppress the popup message that appears because of form validation when no attachments are added.


    var ATTACHMENT_BINDING = 'my:Attachment_1';

    var CONTROLLING_FIELD_PATH = '/my:myFields/my:field_4';

    var REQUIRED_TRIGGER_VALUE = 'X';

    var matchingAttachmentSpans = $j('span[binding="' + ATTACHMENT_BINDING + '"]');

    var attachmentControl = $j(matchingAttachmentSpans[0]);

    var controllingFieldValue = $form.getValue(CONTROLLING_FIELD_PATH);

    if (controllingFieldValue === REQUIRED_TRIGGER_VALUE) {

    SVFormInternalAttachmentValidations[ATTACHMENT_BINDING].minimum = 1;

    attachmentControl.find('input[type=file]').addClass('frm_required_error');

    Utils.addMessageToControl(attachmentControl);

    }

    else {

    SVFormInternalAttachmentValidations[ATTACHMENT_BINDING].minimum = 0;

    attachmentControl.parents('div:first').find('.text-danger').remove();

    attachmentControl.find('input[type=file]').removeClass('frm_required_error');

    }

     

    Usage Scenarios:

    • Vendor onboarding: Require tax certificates
    • Material Master: Safety datasheet mandatory for hazardous materials.
    • Finance Requests: Approval memo for high-value transactions.

    Tips & Tricks

    • Apply conditional mandatory only where business logic demands.
    • Restrict file types to avoid security risks; use configuration keys.
    • Provide error messages for missing attachments.
    • Test rules thoroughly to avoid blocking submissions.
    • Conditional logic errors can prevent form submission.
    • Performance impact: Multiple large attachments slow down form load.

      Best Practices

      • Keep file size limits reasonable (5–10 MB).
      • Use naming conventions for uploaded files.
      • Validate mandatory conditions in both UI and workflow logic.
      • Document rules for audit and troubleshooting



      ------------------------------
      Rishav Kumar
      Product Manager
      *Precisely Software Inc.
      ------------------------------



    • 2.  RE: Tip of the Week - Attachment Control and how to make it mandatory

      Posted 13 hours ago

      hi,

      Is there a way to check whether the correct kind (part of name for example) of documents are attached?

      This is an actual use case we have. Fictive example, at minimum a document containing in the name "...ContractType ABC..." must be attached.

      (potentially not just one document with a specific name but more (like 2 or 3)).

      Thanks.



      ------------------------------
      Ed Meiners
      Lead Consultant MDIM
      Wessanen Nederland Holding BV
      Amsterdam
      ------------------------------