Submit and close in code behind in a Sharepoint workflow initiation form





    I'm trying to make something very simple but I can't find how to do...


    I've got a sharepoint workflow that shows an initiation form to ask the user which attachments he/she wants to take into account for a copy.


    In case there is no attachment, I'd like the intiation form to not show up or to submit automatically since the only goal of it is to ask the user which attachments to take, if there is no attachment there is no reason to ask anything.


    I've got a code behind DLL attached to my form to list the item attachments, from there, I'd like to submit & close the form but it doesn't look possible. Things i've tried:


    - In the form submit options, I checked "close the form after submit"

    - From my code, I try to submit directly, the form isn't closed

    - From my code, I change the value of a field that triggers a rule that must submit the form...the form is not closed



    Well, if the submission is not done when clicking on the button, the form remains opened.



    I think I tried everything and it takes me to the conclusion that what I want to do is just impossible....So the clarified version of the question is:


    - Is it possible to submit & close a workflow form with no intervention of the user (not clicking a button....)?


    I noticed that calling this.submit() from a button works (the data gets submitted and the form is closed and the workflow starts just after.)


    Calling this.submit() anywhere else makes the code either crash (in the loading event) or the form is closed but the workflow doesn't start as it should....



    Any idea?





    Sunday, March 23, 2008 9:12 AM