Prevent Upload of PDF files

Hi Team, Is there any possibility to prevent the upload of PDF files in Document Files relationship tab?   Thank You
  • Hello, You can accomplish this with an onAfterAdd server event on the Document File ItemType. You can use the sample below to perform this check.
    Innovator inn = this.getInnovator();
    // Get the File Type of the file being attached
    Item file = this.getRelatedItem();
    string filetype = file.getProperty("file_type");
    // 7869D76D50ED4BD4985BECB20B1102F7 - Corresponds to the PDF File Type
    // 1F6BEC4E228E4FEDA65D1C3647BDA96D - Corresponds to the 3D PDF File Type
    if (filetype == "7869D76D50ED4BD4985BECB20B1102F7" || filetype == "1F6BEC4E228E4FEDA65D1C3647BDA96D") {
    // Returning an error here will prevent the file from being added
    return inn.newError("Cannot upload PDF File");
    // Returning this will let the Document File be created
    return this;
    Christopher Gillis Aras Labs Software Engineer
  • I tried above code but getting error as Object reference not set to an instance of an object. Guide on this

  • Hi Ashwini

    I checked this method and it works good. Can you try debugging this method ?

    Check this post for enabling debugger


    Gopikrishnan R

Reply Children
No Data