Hi,
I have a work flow that I created in SPD 2007. This workflow is set to start automatically when a new item is created in a document library. I also have an info path form that is a content type in the library that the workflow is applied on. I added a button to the form to be able to start this workflow programmatically ( I will use as there is a case where the automatically started WF will stop so that the user can edit the form and then he can start the WF again and I wanted to make it in the form instead that the user starts it manually). I’m using the workflow web service to start this work flow. The web services takes the URL of the form as a parameter.
I first debugged the code and set the URL to that of an existing form in the library and the workflow started (note: the form was closed at that time) but when I worked from the library, opened the form and clicked the button, the wf status was failed on start (retrying) although that the first task was created but I couldn’t edit it and I had to terminate the workflow.
I searched for the failed on start(retrying) causes and it was mentioned that the WF may include custom activities but that’s not my case.
Finally I figured out that the problem is that the form was opened and that SPD workflows can't start on opened forms. I tested this by working in degugging , setting the URL of the form and opening this form and I got the "Failed on start (retrying)" and this means that the form needs to be closed first but I want to ask how can I achieve this ? Some suggested solutions were building a custom activity at the beginning of WF to wait until the form is closed but I want to know if there is something else. I thought of application.activewindow.close() but it won't work as the code after this line won't be executed so how can I close it first and execute the code??
Thanks.