4

A SharePoint workflow can be associated with a list, and configured to 'start when a new item is created', 'when an item is changed' or 'manually started by an authenticated user'.

This is my screenshot:

screenshot

I need a way of detecting which of these caused the workflow to start in each case. I'm sure there must be some variable which holds which of the above triggered the start of the worklow...

NOTE: I'm developing a SP2010 workflow in C# using Visual Studio.

philipvr
  • 5,738
  • 4
  • 32
  • 44
Tom
  • 251
  • 2
  • 13

2 Answers2

0

Not sure about a variable held somewhere but you could use a date capture/comparison.

You could capture a date/time with your workflow and then compare that to the created date and the modified date using either a calculated column or exporting to excel.

If the created date and the date/time captured in the workflow were within seconds of each other then the workflow was triggered on item create. If they are different but the modified and the date/time captured are within seconds, then the workflow was triggered on item change.

If none of the dates match - then the workflow was probably triggered manually.

Cheers,

MW

moonweazel
  • 79
  • 1
  • 9
0

Create two workflow or use event receiver and put your code in on ItemAdded function for newly added items and ItemUpdate for changes.

regards,