<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Starting a SharePoint Designer Workflow Programmatically on an open form</title><link>https://www.infopathdev.com:443/forums/thread/65163.aspx</link><pubDate>Tue, 15 Mar 2011 08:44:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:65163</guid><dc:creator>Marwa Mostafa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/65163.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=65163</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p style="TEXT-INDENT:-0.25in;MARGIN:0in 0in 0pt 0.5in;mso-list:l0 level1 lfo1;" class="MsoListParagraph"&gt;&lt;span style="COLOR:#1f497d;mso-fareast-font-family:Calibri;mso-bidi-font-family:Calibri;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="FONT:7pt &amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;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.&amp;nbsp;The web services takes the URL of the form as a parameter.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="TEXT-INDENT:-0.25in;MARGIN:0in 0in 0pt 0.5in;mso-list:l0 level1 lfo1;" class="MsoListParagraph"&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 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&amp;nbsp; the library, opened the form and clicked the button, the wf status was &lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;failed on start (retrying)&lt;/span&gt; although that the first task was created but I couldn’t edit it and I had to terminate the workflow. &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;/span&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;/span&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt; 
&lt;p style="MARGIN:0in 0in 0pt 0.5in;" class="MsoListParagraph"&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="MARGIN:0in 0in 0pt 0.5in;" class="MsoListParagraph"&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;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.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0in 0in 0pt 0.5in;" class="MsoListParagraph"&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="MARGIN:0in 0in 0pt 0.5in;" class="MsoListParagraph"&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;Finally I figured out that the problem&amp;nbsp;is that &lt;/font&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3"&gt;the form was opened and that SPD workflows can&amp;#39;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 &amp;quot;Failed on start (retrying)&amp;quot; and this means that the form needs to be closed first but I want to ask how can I achieve this ?&amp;nbsp;Some suggested solutions were&amp;nbsp;building a custom activity at the beginning of WF to wait until the form is closed but I want to&amp;nbsp;know if there is something else. I thought of &amp;nbsp;application.activewindow.close() but it won&amp;#39;t work as the code after this line won&amp;#39;t be executed so how can I close it first and execute the code??&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0in 0in 0pt 0.5in;" class="MsoListParagraph"&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font face="Calibri"&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font face="Calibri"&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3"&gt;Thanks.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/span&gt;</description></item></channel></rss>