cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Notify only when someone attaches a file to an item?

Jump to solution

I would like to fire off a notification if ( and only if ) someone attaches a file to an existing item.  The item may already have attachments from creation, I just need to know if someone ADDS an attachment.

I plan to couple this with Vadim's great tutorial on collecting attachment URLs using a UDA to pipe the actual attachment URLs into this notification....

Not sure how to go about doing this.  Perhaps I could use Nintex forms somehow to pass a variable when a file is attached?

0 Kudos
Reply
9 Replies
Workflow Hero

Re: Notify only when someone attaches a file to an item?

Jump to solution

You can use REST API call in JSON to get the attachment details in the Nintex Form Custom JavaScript. For more details check spservices - Display attachments for each list item - SharePoint Stack Exchange  

0 Kudos
Reply
Workflow Hero

Re: Notify only when someone attaches a file to an item?

Jump to solution

Hi,

unfortunately I don't think it's possible to know if an attachment as just been added..

I think that you have to store in a field of the item some details about the current attachments, so when the item is modified you workflow runs, it checks if the attachments are the same of the ones listed in your field and if yes, it ends otherwise it could do your custom notification logics.

Giacomo

0 Kudos
Reply
Workflow Hero

Re: Notify only when someone attaches a file to an item?

Jump to solution

The check for attachments can be taken care in the workflow setting 'Start when the item is modified' set to conditional as shown below:

Reply
Workflow Hero

Re: Notify only when someone attaches a file to an item?

Jump to solution

Chaitra, I didn't know this was possible, I think this is my solution, thank you!

0 Kudos
Reply
Workflow Hero

Re: Notify only when someone attaches a file to an item?

Jump to solution

Chaitra, I take it back   This doesn't solve my issue because the check for attachments is only True or False, so the conditional start only fires if there were NO attachments previously and now there are.  It won't fire if someone adds an additional attachment later.

0 Kudos
Reply
Workflow Hero

Re: Notify only when someone attaches a file to an item?

Jump to solution

Chris Almaguer‌, you can use the GetAttachmentCollection Web service to read the attachments for an item.  I would create a field on my list called "Number Attachments" where you can store the number of attachments an item has.  Then when an item is modified, you can run a workflow that gets the current collection of attachments, and compares it to the number in that field.  If it's different, then you can send your notifications.   Here is a workflow that I set up that accomplishes it. 

Here is how you setup the Web Service Call.  For the List Name use the List Name from Common Properties, and then the ID number for the current Item.

Once you get these Web Service Call results, use a Query XML to extract the attachments and put them in a collection variable.  You can then do a count on the collection to determine how many attachments you have.  

The very last thing you'll need to do is update the Number of Attachments field so that it matches the current number. 

Reply
Workflow Hero

Re: Notify only when someone attaches a file to an item?

Jump to solution

Agree with Brendan Murphy. This will work. 

0 Kudos
Reply
Workflow Hero

Re: Notify only when someone attaches a file to an item?

Jump to solution

Thanks Brendan!  This is a complex solution but looks like the only way to go.

0 Kudos
Reply
Workflow Hero

Re: Notify only when someone attaches a file to an item?

Jump to solution

Complex??  It's only 6 steps.   If this works, please update the answer as well for others that come along.  Thanks. 

0 Kudos
Reply