4
votes

I have a SPD workflow that is set to run when an item changes but it keeps getting triggered on new items, which is pretty annoying. I'm looking into why this is happening but I'm also looking for a way to terminate the workflow if the item is new as a temporary workaround.

I tried to compare the Created field to the Modified field i.e. if Created and Modified are the same then don't run. This didn't work, either as a date or string comparison.

Any suggestions would be much appreciated.

4

4 Answers

1
votes

Store a flag in a hidden field the first time the workflow is run. Check if the flag is present, if not then it is the first time (created), otherwise it is updated.

0
votes

I have faced this same issue and I solved with the workaround like this

  1. Take created date and add 1 minute with it and assign it to a variable
  2. Check this variable less than current time.

    It done with the following assumption

a. No one try t edit the item within one minute, it created

b. Workflow will execute within one minete

In my case it was success

0
votes

The comparison between the created time and modified time works on SharePoint 2010 (it is used here). Perhaps the comparison is done incorrectly or the wrong object is used to get the data from?

If said approach does not work on 2007, perhaps it may be possible to use the owshiddenversion field (directly access as property if not correctly exposed). It should be 1 for a newly created item, and > 1 otherwise. It may only be available on versioned lists, I do not recall.

0
votes

Try adding a condition which compares the create date with the modified date.

i.e.: if current item:created not equals current item:modified