Explicitly handling FILE Attachment control in NINTEX by custom coding

Blog Post created by mbhattacharyanetwoven on Sep 13, 2016


Think about a situation where authorised user can view, add and delete the attachments and unauthorised user can only view the attachments inside a form. They will not have any rights to Add or delete any attachments from the listing. You can think that it could be easily handled by NINTEX rules. Yes, off course but there is a problem. The unauthorised user can download and view the attachments in IE but they can’t download or view from Chrome and Firefox. And yes I found it’s true when I was doing my last project. So how to download and make viewable to all the attachments to all unauthorised users from Chrome and Firefox browser restricting them to add and delete any more. Let’s see…


You can think the File attachment control has two sections inside in it(for sake of understanding right now). One is the name of the file where it gets displayed after uploading and the second one is comprised of two buttons i.e.  ‘Delete’ and ‘Add’.

Putting the NINTEX rule to File Attachment control is applied to all the sections inside in it. You need to put that rule definitely to restrict the unauthorised user from Add and Delete of the attachment. But in our case we want Unauthorised user can download and see the attachments but can’t Add or Delete any attachment. And if you go to IE you can see unauthorised user can download that file and can see it but they can't add/delete any file there. It’s perfect. But in Chrome and Mozilla they can’t download and can’t also see it. To handle this situation, we need to handle explicitly our File Attachment control and here it is…



Go to the form custom coding section and under NWF.FormFiller.Events.RegisterAfterReady fuction try to get hold of the File attachment control by jquery like this:

var rowInputFileName = NWF$(".nf-attachmentsTable tr[id*='attachRow'],.nf-attachmentsTable tr[id*='idAttachmentsRow']");

and then set the disabled property to false to all of the controls where the Attached file names are displayed and the code look like this:

rowInputFileName.each(function() {

                                                var anchor = NWF$(this).find("a");



Now you can see the Hyperlink for those uploaded file is enabled in Chrome and Firefox browser from where you can download and view the attached files.

Hope this will help you to handle the File Attachment control explicitly to handle such type of situation that I demonstrated.