JochenLeitner

I have a button with rules and code. I want to know what is executed first - the rules or the code behind. In my opinion it are the rules. How can I change this I want the code to be executed first.

thx



Re: SharePoint - InfoPath Forms Services Button including rules and code

SYM Wong-A-Ton

Rules run before code. There is no setting in InfoPath to change this. Do you have anything the rule does that you cannot do in code If not, why not write all the logic in code I haven't really tried this, but you could try making the rule dependent on a field (use a Condition on the rule) and then set the value of that field through code and see whether you can manipulate the execution of the rule that way through code.





Re: SharePoint - InfoPath Forms Services Button including rules and code

JochenLeitner

The rule is to close the form but before a closing the form I want to execute some code. How is it possible in visual basic to close the form or to submit the form using a dataconnection which I have added in infopath.

thank you





Re: SharePoint - InfoPath Forms Services Button including rules and code

SYM Wong-A-Ton

If you're using a browser form, I'm not sure if the Close() method would be available, since I've never tried it. It is available in the InfoPath client, though (see http://msdn2.microsoft.com/en-us/library/microsoft.office.infopath.xmlform.close(VS.80).aspx). As to how to submit programmatically: You can retrieve the data connection and call its Execute() method (see http://msdn2.microsoft.com/en-us/library/microsoft.office.infopath.xmlform.dataconnections(VS.80).aspx and http://msdn2.microsoft.com/en-us/library/microsoft.office.infopath.dataconnection.execute(VS.80).aspx). Make sure the data connection you've set up supports submitting data. So use something like:

Code Block
DataConnections("<my_data_connection_name>").Execute()

where "<my_data_connection_name>" is the name you gave the secondary data source that supports submitting data.





Re: SharePoint - InfoPath Forms Services Button including rules and code

JochenLeitner

I am tried this code expression to close the form

Me.thisApplication.Quit(True)





Re: SharePoint - InfoPath Forms Services Button including rules and code

JochenLeitner

Me.thisApplication.Quit(True) doesn't work with browser based forms.

I have tried the statement Me.Close() but I get a message like this "Close is not a member from "myProject.FormCode"".

Do I have to add some import statements

Thx.





Re: SharePoint - InfoPath Forms Services Button including rules and code

nstorandt

Hey,

I had a similar wish. But I didn't found any solution to close a browser enabled form by using code behind.

So i decide to use one button for saving and another button which has only the rule to close the form.

I had read a lot of posts about this topic and had found a suggestion which coul be help, but I have no time to test it yet.

Try to navigate after submitting your form back to the doc library where you have published it.

System.Diagnostics.Process.Start(URL)

greets