Explicitly Handling FILE Attachment Control in NINTEX by Custom Coding - Netwoven

Explicitly Handling FILE Attachment Control in NINTEX by Custom Coding

By Mani Shankar  |  Published on October 17, 2017

Explicitly Handling FILE Attachment Control in NINTEX by Custom Coding

Overview of the problem: Think about a situation where authorized user can view, add and delete the attachments and unauthorized 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 unauthorized 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 unauthorized 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 unauthorized user from Add and Delete of the attachment. But in our case we want unauthorized user can download and see the attachments but can’t Add or Delete any attachment. And if you go to IE you can see unauthorized user can download that file and can’t see it but they can 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

Solution: 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.

Leave a comment

Your email address will not be published. Required fields are marked *

Unravel The Complex
Stay Connected

Subscribe and receive the latest insights

Netwoven Inc. - Microsoft Solutions Partner

Get involved by tagging Netwoven experiences using our official hashtag #UnravelTheComplex