Using Attachments to Trigger Rules

Forums Dynamic Forms for SharePoint Using Attachments to Trigger Rules

This topic contains 1 reply, has 2 voices, and was last updated by  Alexander Bautz 7 months, 2 weeks ago.

  • Author
  • #21124


    I would like to trigger a rule if someone ADDS a file to a list item. The Attachment field is Boolean and only checks if there is something there, not if something is new. So I thought maybe you could count the number of attachments and then compare for change to trigger a rule in DFFS or a workflow.

    I checked the web and there wasn’t much that gave me hope. I did find one site that put the output to a cvs file, but it is not DFFS friendly.

    However I did notice they were using item.AttachmentFiles.Count so I tinkered with the code below, but I keep getting various errors depending on how I have it configured.

    I either get an undefined error or a function expected error. I tried it with a function name called by a rule and still no dice.

    I tried it like this
    var IAFC = spjs.dffs(item.AttachmentFiles.Count)
    var IAFC = (item.AttachmentFiles.Count)
    and all versions in between. Even tried AttachmentId

                    var IAFC = spjs.dffs(item.AttachmentFiles.Count);
                    var AFC = spjs.dffs("Attachment_Files_Count");
                    var NAFC =  Math.floor(IAFC + AFC);


    Thoughts? Suggestions?

  • #21138

    Alexander Bautz

    You can add this snippet to your Custom JS:

    var attachmentCount = spjs.dffs.beforeProperties.Attachments.length;
    	var count = jQuery("#idAttachmentsTable tr").length;
    	if(count > attachmentCount){
    		attachmentCount = count;

    You must change “NewAttachment” to match the UniqueId of the rule you want to trigger.


You must be logged in to reply to this topic.