The answer to my original question could have worked as Mark suggested, by looking at Context.Site.Name during the onSaving event, but then I tried to go with the best practice and use UISaved pipeline, as it triggers only when the Sitecore user "Saves" from within the Sitecore Content editor, so that worked perfectly for my case.
I was trying to change my workflow state field, but for some reason the changes wouldn't reflect in the item after saving, however this is how it finally worked:
I added the following code:
public class SaveUIProcessor
public virtual void Process(SaveArgs args)
foreach (SaveArgs.SaveItem saveItem in args.Items)
var item = Sitecore.Context.ContentDatabase.Items[saveItem.ID, saveItem.Language, saveItem.Version];
if (item != null)
protected virtual void setWorkflowState(Item item)
using (new Sitecore.SecurityModel.SecurityDisabler())
item.Fields["__Workflow"].Value = WorkflowID;
item.Fields["__Workflow State"].Value = ReviewStateID;
Sitecore.Diagnostics.Log.SingleError("Error in workflow state set on saveui" + ex, ex);
I also added the following patch in a .config file for the processor, it ensures that my custom code runs before Sitecore.Pipelines.Save.WorkflowSaveCommand:
<processor mode="on" type="Example.Workflows.SaveUIProcessor, Example.Workflows" patch:before="processor[@type='Sitecore.Pipelines.Save.WorkflowSaveCommand, Sitecore.Kernel']" />
After doing this, the changes reflected successfully.
this answer was also pretty helpful https://sitecore.stackexchange.com/a/923/3547
publisherwhen publish is running.