I have an InfoPath 2010 form that needs to perform a Sharepoint 2010 list query based on the value of an input parameter. I get the input parameter value with a small chunk of C# code in the FormEvents_Loading function. This code works fine and has been tested to acquire the correct value.
When I add a Form Load rule that attempts to perform the Sharepoint list query using the input parameter value, the lookup always fails. It appears that this happens because at the time of the Form Load rule execution the FormEvents_Loading code has not yet executed. Is this correct; the Form Load rules run before the FormEvents_Loading code?
How can I solve this chicken-before-the-egg problem? I really don't want to embed the Sharepoint list query in code because this form will be used in many other sites. As I understand it, in order to perform Sharepoint list queries from InfoPath in code I have to embed some site and list-specific values (site path, list GUID, etc). How can that be a portable solution?
TIA.