Using Attachments to Trigger Rules

Forums Classic DFFS Using Attachments to Trigger Rules

Viewing 1 reply thread
  • 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.


Viewing 1 reply thread
  • You must be logged in to reply to this topic.