Thursday, 16 March 2017

SharePoint Designer: What does a workflow lookup returns when the item is not found?


Item not found returns: ?????

Unassigned workflow variable returns: ****

Note: If you will look for ID of an item that does not exists then the variable will be assigned to 0.


Tuesday, 7 March 2017

Fixed: SharePoint 2013 workflow not starting on programmatically creating new list item.


For SharePoint 2013:

Just add "Log <this message> to the workflow history list" as the first statement in the workflow.


For SharePoint 2010:

Add below code just after item creation:

using(SPSitesite=newSPSite(web.Url))
{
  foreach(SPWorkflowAssociation spwfa in list.WorkflowAssociations)
  {
   if(spwfa.Name=="WorkFlow Name")
   {
    spwfa.AutoStartCreate=true;
  site.WorkflowManager.StartWorkflow(newItem,spwfa,spwfa.AssociationData);
   }
  }

}