Skip to main content
Nintex Community Menu Bar

How to count attachments within the nintex form (no workflows)

  • December 14, 2021
  • 2 replies
  • 378 views

I am trying to count/sum the total number of attachments in a nintex form. I will use that number to set a field within the form so a workflow is not optimal.

2 replies

allan
Forum|alt.badge.img+9
  • Rookie
  • December 15, 2021

What you can do is place this JS code in  the Advanced section of your form settings : 

function GetNumberOfAttachments(attCtrlClassName){ return NWF.FormFiller.Attachments.GetAttachedFilesCount(NWF.FormFiller.Functions.GetFillerDivObjectForControl(NWF$("#"+NWF$("." + attCtrlClassName + " .nf-attachmentsRow")[0].id)).data('controlid')) }

 

And add a CSS class on your attachments control, let say "MyAttachmentsControl".

You will then be able to use this function in a rule : 

GetNumberOfAttachments("MyAttachementsControl") < 5



 


Forum|alt.badge.img+4

Unfortunately, this suggestion does not work for the new responsive designer for Nintex Forms for SharePoint Online. There's no way to embed custom JS code on the form.