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

Workflow: Email Notification based on conditions ...

Jump to solution

Hello Everybody

I am new here and hope to be able to learn and get some support

I am also new to SharePoint / Nintex and would ask for your patients.

Right, here we go...

I like to create a workflow to send an email out to certain users only when:

  • a new document has been added to a specific category
  • an existing document within specific category has been modified/changed/updated.

What I have done so far is, created a Document List with its categories and set up a filter as seen below:

DocLibrary.JPG

I also created the workflow as following:

Workflow1.JPG

1st Condition (top)

1stCondition.JPG

2nd Condition (left branch)

2ndCondition.JPG

Its purpose is to check if the uploaded file is NOT the same as other documents!
Hint: just noticed it should be "is not equal" but yeh ... I changed that in meantime and yet not working!

3rd Condition (right branch)

3rdCondition.JPG

... this is a pain this!
The issue with the uploaded files is that the Uploaded on and Updated on - are only the same when
the user manages to upload the file within a minute ... otherwise there always be a time difference.

I am stuck how to get around this and driving me insane.
Probably, I am over-complicating it myself and it may be just a case of an easier solution.

Would be thankful if you can help me out

Thanks

Labels: (2)
Reply
14 Replies
Workflow Hero

Re: Workflow: Email Notification based on conditions ...

Jump to solution

Hi Bim,

I would recommend to create two seperate workflows.

1. Workflow "a new document has been added to a specific category"

  • Let Workflow Start on item updated (item added won't work because you don't have access to your list columns)
  • Create a new column in your list called something like "uploadNotificationSent" (yes/no, default value: no)
  • For the first step in your workflow you check if the "uploadNotificationSent" is set to true
  • If it is true: do nothing
  • If it is false: send your notification (and maybe use additional conditions to check for your categories as required)
  • Add an "Wait for..." action and let it wait some minutes (this is only to stabilize the second workflow)
  • At last you set the "uploadNotificationSent" to true

Conclusion: This worklfow will run only once when an item is added and send your notification informing about the newly added item.

2. Workflow "an existing document within specific category has been modified/changed/updated."

  • Let Workflow start on item updated
  • Check for your "uploadNotificationSent" column
  • If it is false: do nothing (means that the first workflow has not been completed and therefore it is an itemUpdated event while adding the item)
  • If it is true: send your notification (and use additional conditions to check for your categories as required). The column being true means that this workflow runs on an item, for which the first upload notification has already been sent and therefore we are talking about an existing item being changed.

Conclusion: This workflow will run every time the item is being updated. But if the "itemUpdated" event occurs for the first time (which it does when you uploaded the item for the first time) the workflow won't do anything.

==> Both workflows will always start when an item is being added/updated. But only the correct workflow will perform something while the other one quits immediately.

It is a little complicated to understand the difference between itemAdded/itemUpdated in a library. If you upload the document, the itemAdded event fires. But after you have uploaded the document, sharepoint asks you to fill out the columns. At this point, the itemAdded event is already gone. If you fill in the columns and click save, the itemUpdated event will fire (although you are actually uploading a new item).

Let us know if this could work for you or if you need any further assistance.

Cheers

Philipp

Reply
Workflow Hero

Re: Workflow: Email Notification based on conditions ...

Jump to solution

Hello Philip

Thanks for your suggestion

I was hopping to do this within 1 workflow, hence why I tried with the Parallel Action ; where one runs if a condition is met

and the other one stops if not met. Tried to compare the name of the uploaded file to check if it's already there and if YES then it should stop the workflow.

You suggested to create a new column in your list called something like "uploadNotificationSent" (yes/no, default value: no)

- I guess this will be a choice-option

So, how will the "uploadNotificationSent" column be updated ???  via the Workflow???

0 Kudos
Reply
Workflow Hero

Re: Workflow: Email Notification based on conditions ...

Jump to solution

Ahhhh!! Wait wait ...

by default it is set to "no" so the workflow should filter IF CATEGORY is = Exec Update AND "NO" run the 1st WF ?

But will it not require the column to be updated to "yes" after 1st wf is completed?

0 Kudos
Reply
Workflow Hero

Re: Workflow: Email Notification based on conditions ...

Jump to solution

The "uploadNotificationSent" column should be of type "yes/no" not a choice option. Choice option would work too, but it's easier to evaluate/set a yes/no column via nintex workflow.

And yes, you need to update this column at the end of the 1st Workflow, just as I said in my first post:

"At last you set the "uploadNotificationSent" to true"

Last bullet point of first WF instruction

Edit:

Regarding the all-in-one WF with parallel actions:It maybe possible to put this all in one workflow. But then dont use the "Stop Workflow" action in one of your parallel paths. This would mean that if one condition is not set, the whole workflow is being terminated although the other condition may result to true and therefore your workflow should perform.

Reply
Workflow Hero

Re: Workflow: Email Notification based on conditions ...

Jump to solution

right ... I will keep u updated once I get some time to do it

ps: not sure about this "item added won't work because you don't have access to your list columns" but I have Admin rights

0 Kudos
Reply
Workflow Hero

Re: Workflow: Email Notification based on conditions ...

Jump to solution

This remark isn't related to a permission issue. It is just SharePoint-Design and I can try to explain it a little further. Imagine the following:

  1. You navigate to your library and press on the upload button. You choose the file from your computer and press the ok button.
  2. Now SharePoint executes the ItemAdded event and this is the point where workflows will start with the start option "Start when items are added". Be aware that you have not filled in any of the metadata columns of your document yet!
  3. SharePoint brings up the screen where you can fill in the metadata columns. So you fill out everything and press the save button.
  4. Now SharePoint executes the ItemChanged event and this is the point where workflow will start with the start option "Start when items are changed"

Now you see where the problem is? If you start a workflow on the ItemAdded event, you will not have any information in the columns because you - as a user - will fill out these columns AFTER the ItemAdded event is already fired.

Long story short: If you want to run a workflow in a document library and you need to access the information from the columns, Workflow-Start on "When items are changed" won't work for you.

Cheers

Philipp

Reply
Workflow Hero

Re: Workflow: Email Notification based on conditions ...

Jump to solution

Hey Buddy

I am in process this and the CONDITION that I set to check at the very beginning is:

- check if "uploadNotificationSent" is equal to false and

- check if "category" is equal to "Exec Update"

Strangely, when I upload a file the condition does the opposite.

SetCondition_notWorking.JPG

SET CONDITION

SetCondition.JPG

Currently, once a file has been added; the SET CONDITION goes the NO direction instead of YES

0 Kudos
Reply
Workflow Hero

Re: Workflow: Email Notification based on conditions ...

Jump to solution

SMALL UPDATE

since I was not able to make it work the way as suggested by Phil.
I thought to myself why not try another approach as seen below:

runningWF.JPG

I included a PAUSE FOR... 1minute because the SET A CONDITION seemed not to be picking up the uploadNotificatioSent=NO
Thinking to myself: maybe I should have used the RUN IF function instead ?? hmmm!!

Anyway, the above workflow hits 2 birds with one stone in other words; it does both :

  1. sends email when a file within category Exec Update has been uploaded
  2. sends email when a file within category Exec Update has been updated

I also changed the WF Settings:

Start when items are created: YES

Start when items are modified: CONDITIONAL > when category: Exec Update

DOWNSIDE:

The only tiny bit that bugs me is that the TIMER is taking longer than 1 minute (usually round 5 minutes)
Not sure why, but I guess might have to do with SharePoint Timer ??? (of which I do not have any control over)


Yes, the timer runs every time the WF runs and even when a file has been updated.

SUGGESTIONS ?

Any other suggestions about it...

PS: Special thanks to Phil for the support

0 Kudos
Reply
Workflow Hero

Re: Workflow: Email Notification based on conditions ...

Jump to solution

As long as you have your workflow up and running, I'm happy

Regarding the timer job: You are right. The SharePoint Workflow Timer Job is set to 5 minutes by default. You could change this in the central administration (if you had permissions). So you can configure less than 5 minutes in the nintex action but the workflow will always wait at least 5 minutes.

Cheers

Philipp

Reply