Returning data from a called form - InfoPath Dev
in

InfoPath Dev

Returning data from a called form

Last post 10-29-2010 08:16 AM by Hilary Stoupa. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 10-27-2010 05:28 PM

    Returning data from a called form

    My company is getting ready to deploy Windows 7 and Office 2010, including Infopath 2010. We have literally hundreds of Infopath client based forms that use a custom 'find' button to lookup and retrieve some user ID and Name from AD. To make a long story short, these find buttons will not work with IP 2010. We are beginning the process of converting these forms to use a contact selector.

    I have one very complex form in which I absolutely can not modify the xml schema to use the contact selector. So I came up with the idea of creating a separate form that contains a contact selector, then call that form from the existing buttons. I think I can come up with code to invoke the form as an object variable (which should give me access to the contact form xml), then set the appropriate existing schema nodes from the contact selector xml values. My difficulty is in trying to make the process synchronous ... invoke the form from code using an object variable, suspend the code while the contact selector is being filled out, then resume the code after submitting the contact selector form.

    Will something like this pseudocode work?

    set objvar to new instance of cs form
    do
       wait 1 second 
       get cs form xml
       if cs.done = true then exit loop
    loop

    set xml ID node = cs.id
    set xml Name node = cs.name

    Am I completely nuts or is this possible?

    Steve
  • 10-28-2010 12:56 AM In reply to

    Re: Returning data from a called form

    Hi Steve,

    Just buy a cheap copy of Qdabra's Active Directory Web Service and you will save a lot of hassle. No code and no separate form. Works with 2010. Easy money.

    Ask Clayton Cobb if you need a testimonial. He's running into the same issue for all of his forms and is using ADWS to solve them.

    Oh, and there's a free trial available as part of the DBXL download (or you can send an email and we'll send you a fully functional copy for eval - let me know).

    Patrick Halstead
    Project Manager at Qdabra
  • 10-28-2010 07:00 AM In reply to

    Re: Returning data from a called form

    But can it be used without modifying the existing schema? For the one form that is an absolute requirement.

    Steve
  • 10-28-2010 12:54 PM In reply to

    Re: Returning data from a called form

    I managed to get the main form to open the new form and access it's xml, but the loop would run continuously preventing user interaction with the new form. Without the loop it would run asynchronously, completing the sub before getting the contact selector filled in and submitted.

     So now I'm thinking of adding code to the contact selector form, and passing in 3 parameters when called: formid, fieldname1, fieldname2. Then code the submit button to find the form instance identified by formid, accessing its xml schema, and updating the values of Fieldname1 and Fieldname2 with AccountId and Displayname.

    Any tips on how to find and access the calling form's xml?

    Steve
  • 10-28-2010 09:55 PM In reply to

    Re: Returning data from a called form

    Seems overly complex. Adding the cheap ADWS Web service doesn't affect the main data source. You add a data connection for it and you get a secondary data source. Then, you can copy values from it to your main data source, just like when using UserProfileService. Anyway, no hard sell here - I just hate to see people create hacky solutions that will cost more to maintain down the road.

    Patrick Halstead
    Project Manager at Qdabra
  • 10-29-2010 07:22 AM In reply to

    Re: Returning data from a called form

    Patrick, I'd love to use ADWS and would buy it in a New York minute if it will do what I need.

    I need to allow the user to enter a search value and click the find button had have it present a list of matches to choose from. When the choice is made it needs to repopulate the search box with the username, and an accompanying text box with account id. I can't figure out how to get ADWS to do that.

    Steve
  • 10-29-2010 08:16 AM In reply to

    Re: Returning data from a called form

    Hi:

    ADWS offers FindUsersByAlias and FindUsersByName.

    If you had (for example) fields in your main data source for user name and for alias, and something in a secondary data source or your main for your search term (I'd use a secondary Util XML file, but that's me). Then you add a button to your form and the button rules would set the query field in the data connection to the web service you choose to use (depending on whether you let your users search by name or by alias) and run the query. The results could be displayed in a drop down bound to the alias field -- the results return the alias and the name of all matches (and you can even set the type of search you want -- "Contains", "Exact", "Starts With", "Ends With" -- heck, you could give your users a choice as to HOW or WHAT they want to search if you wanted). User selects correct person from drop down, which sets alias -- and you could add a rule from there to set the name.

    Hilary Stoupa

Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.