Why does SharePoint workflow fail to start when document uploaded by another workflow? - sharepoint

Office 365 - SharePoint 2013 Workflow
I have two Document Libraries:
Work In Progress
Archived
There is a SharePoint 2013 List Workflow Add Document attached to Work In Progress with attribute "Start workflow automatically when an item is created" set. This workflow copies the new document to the Archived library.
There is a SharePoint 2013 List Workflow Archive Rename attached to Archived with attribute "Start workflow automatically when an item is created" set. This workflow renames the new document.
Both Workflows were designed in SharePoint Designer - there is no custom code.
The Archive Rename Workflow is not starting when the document is copied by the Add Document Workflow, although it does start correctly when a document is uploaded manually through the UI.
I've seen a similar topic here [SharePoint workflow does not start for automatically uploaded documents][1]
[1]: SharePoint workflow does not start for automatically uploaded documents but that is concerned with custom code. This project cannot use custom code.
Does anyone have any ideas why the second Workflow is not being triggered?
Thanks
Edward

This is done to prevent workflow recursion. You can start another workflow using Start Sharepoint 2010 workflow action or rest api. There is one possile solution in details: http://blogs.msdn.com/b/sridhara/archive/2014/08/21/fix-sharepoint-2013-workflow-recursion-prevention-part-2.aspx

Related

Why disabling Workflows to start automatically in SharePoint through ListSettings>Change a Workflow, does not work?

I had several workflows created in SharePoint Designer 2013 for SharePoint 2013, and I needed to disable some of them before "Creating New Items" in bulk by using a Quick-Edit view, so they would not send e-mails/change values/or create new items, as they were supposed to do if the setting: "Creating a new item will start this workflow.", would have been enabled in the List Settings/Change a Workflow page.
I uploaded the new records with the quick edit method, and then I whent to look for a change that one of the Workflows that I left enabled... ...long story short: Workflows that were disabled, were running... All of them!!
Does someone know why if I disable workflows through the SharePoint UI,so they DO NOT get executed automatically when adding or updating items, they still get executed when adding new items or editing values. Or why the same setting does not seems to be changed if I open the workflow configuration in SharePoint Designer 2013? Do I need to make a change in SharePoint and through SharePoint Designer so the change is honored?
To clarify: If I uncheck the box that says "Creating an item will start this workflow." through the SharePoint UI. Then, save the changes to the list, then; however, if I open SharePoint Designer I see that the box "Start workflow automatically when an item is created" IS ENABLED!!!
Does it is needed to make a change in SharePoint and through SharePoint Designer so the change is honored?

Create a 2010 workflow in Visual Studio 2012 for SharePoint Online

I have a solution in VS2012 with a SharePoint 2013 sandboxed project. I have created some custom workflows in 2013.
What I really need to do is to have an approval workflow to publish content, and send out an email when a new document is approved.
My first thought was to use the OOB approval 2010 workflow and use an event receiver on the list. When an item becomes approved, I would send out an email, but I'm unable to send emails programmatically in SharePoint online.
My second thought was to recreate the workflow in 2013, since I know I can send emails out that way, but it looks like the activities related to content approval were removed for 2013 workflows. I can try and do the approvals via rest calls, but my concern was that my workflow will fire every time the item in the list changes (even if it's not a publish), so I will have to check (in the workflow) if the item is being published or not. This will cause the workflow history for the items to become pretty useless as it will be filled with mostly white noise. Also, as far as I can tell, the checkbox when you create an association for "Start this workflow to approve publishing a major version of an item." does not apply to 2013 workflows.
I believe my best answer at this time would be to create a custom 2010 workflow, but I don't see how I can do that from inside VS2012. Can anyone help me (or maybe suggestion another alternative to achieving my goal?)
You can just turn on the old (2007) approval workflows. It sounds like those might work for you.
This article references how to do that, but in short it is under
Site Settings -> Site Collection Administration -> Site Collection Features -> enable the feature 'SharePoint 2007 Workflows'
Configuring SharePoint 2013 to use legacy workflows
I ended up using an OOB 2010 Workflow and modifying it with SharePoint Designer. Not really the solution I wanted (which was to package ALL of my customizations into a single WSP), but I've spent more time than I should have trying to get it to work.

Is it possible to update a TFS task whenever an artefact is uploaded into TFS-Sharepoint

We use TFS integrated with Sharepoint for storing artefacts. Examples: end user documentation.
The artifacts are uploaded using Visual studio 2010 and not from web interface.
For each artefact preparation, there will be a task created in TFS.
Example:
Documentation preparation
The requirement is whenever a document is uploaded or modified in the sharepoint folder, can the user be alerted?
Example:
which TFS task he/she needs to update the completed hours
FOlder structure:
similar to the one shown in the 2nd answer to the below question
Share project documents in TFS different ways, what are your best practices?
It's not there by default, but one could build it oneself using a ListItemEventHandler (http://msdn.microsoft.com/en-us/library/ms437502.aspx) in sharepoint or a custom aproval workflow that activates from within sharepoint and creates workitems in TFS using the object model (http://msdn.microsoft.com/en-us/library/bb130322.aspx).
The requirement is whenever a document is uploaded or modified in the
sharepoint folder, can the user be alerted?
A simpler way to achieve only this requirement might be to put an sharepoint alert on the document list so one would recieve an e-mail when an item is created.

Is it possible to add workflow modification programmatically?

I`m interested in adding SharePoint Workflow Modification programmatically from my workflow, without using forms.
What i'm trying to achieve - I want to add Workflow modification when user uploads new document version to document library. I have OnWorkflowItemChanged and from there i'm willing to add WF Modification.
Is this possible?
To clarify some things:
I`m writing a custom Workflow in Visual Studio.
What I want is to add items to (SPWorkflowModificationCollection) SPWorkflow.Modifications object. However there is no Add method, but the designed way to add items there is by using Workflow Modification forms.
In this case, i don't want user to use modification form, but i want to add workflow modifications (which will populate the collection AND triger OnWorkflowModified event).
I am not 100% sure what you mean by workflow modification. Do you want to modify the workflow itself from a workflow or just modify a document or item from a SharePoint Workflow?
Regardless, I'll give you the same answer to what was accepted as the answer to a similar question.
Workflow is one of the strong parts of SharePoint. Out-of-the box you or your users can build workflows using the free SharePoint Designer. Depending on your exact requirements this may be good enough.
If you need a more advanced workflow editor then you may want to consider Nintex Workflow or K2. Alternatively you can write your own workflows in Visual Studio or buy 3rd part Workflow Actions for SharePoint Designer.
I have included some useful links below:
Building workflows using SharePoint Designer
Creating workflows using Visual Studio
3rd Part Workflow actions to embed VB or C# directly into SharePoint Designer Workflows. Note that I have worked on this product so consider my recommendation biased ;-)

Cannot associate a custom SharePoint Workflow with a Content Type in SharePoint Server 2010

To preface, I am working with SharePoint Server 2010 Beta 2, Visual Studio 2010 Ultimate RC.
I have built a custom Content Type based on the Item type with a few custom site columns. I also have built a custom Sequential Workflow using Visual Studio 2010. This is a relatively simple workflow that creates a task, waits for the task to complete, sets the workflow to complete. I am able to deploy this workflow to the site collection through VS 2010 deploy (which is pretty nice, btw). The problem I have is that when I try to associate the custom Content Type with my custom workflow, that workflow is not listed in the workflow templates to choose from. There are only the OOTB SharePoint workflows to choose. The kicker is that if I create a list and associate a workflow to that list, my custom workflow is in the workflow template list. This makes sense since at the start of building a custom workflow in VS2010, one of the first questions is whether the workflow is a Site or a List workflow and I selected List. Is the issue that List workflows are not allowed to be associated with Content Types?!?
Thanks.
In your workflow's elements.xml, look for AssociationCategories and change it to ContentType like so:
<AssociationCategories>ContentType</AssociationCategories>
Big thanks to my co-worker, Yves for pointing this out :)

Resources