How to get a SharePoint workflow event / trigger?

A SharePoint workflow can be linked to a list and configured to "run when a new item is created," "when the item is changed," or "manually started by an authenticated user."

This is my screenshot:

screenshot

I need a way to discover why the workflow started in each case. I am sure there must be some kind of variable that contains what from the above started the start of worklow ...

NOTE. I am developing a SP2010 workflow in C # using Visual Studio.

+4
source share
2 answers

Not sure if the variable is stored somewhere, but you can use date capture / comparison.

You can write the date / time into the workflow, and then compare it with the created date and the modified date, using either a computed column or exporting to excel.

If the created date and date / time recorded in the workflow were a few seconds apart, the workflow started when the item was created. If they differ from each other, but the changes and the date / time are captured within a few seconds, the workflow starts when the element changes.

If none of the dates matches, the workflow probably started manually.

Greetings

MW

0
source

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

Yours faithfully,

0
source

All Articles