Opening a form based on a submitted view - InfoPath Dev
in

InfoPath Dev

Opening a form based on a submitted view

Last post 07-31-2013 07:20 AM by Sandy_Wood. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-30-2013 08:21 AM

    Opening a form based on a submitted view

     I've got a form that has three different possible views that can be submitted to a single SharePoint 2010 form library. Once they are submitted, I haven't found a way to open the submitted forms based on the views they were submitted with. I thought a Form Load Rule might do the trick by having the Submit button stamp the submitted form with a field after submission. That way, I thought A Form Load Rule could look for a specific value before opening.

  • 07-30-2013 12:08 PM In reply to

    Re: Opening a form based on a submitted view

     I actually had the same requirement and this is how I solved for it. I was building a ticket form for 3 types of tickets. on initial load of the form I have a "Main" view (only loads once) that allows the user to select the type of ticket. Now you can get this value from the URL if you want or how ever you are now, but you have to at least know this value of the view. When the user clicked one of three buttons I set a field "TicketType" to the view value. The is a hidden field and doesn't change on my form, but most likely will on yours. So you just need either on save or some change event set the value of that field to your view name. OnForm load I run a little piece of code to set the default view which that value is pulled from the field "TicketType", maybe yours is "ViewName". So in the FormEvents_Loading I put this code. the value of my "TicketType" field is my default view

    
                    // Create an XPathNavigator object for field - the field for switching the View
    
                    XPN DefaultView = CreateNavigator().SelectSingleNode("xpath to field", NamespaceManager);
                    // Make sure that the XPathNavigator object is not null or an empty string
                    if (DefaultView != null && DefaultView.Value != "")
    
                    {
                       e.SetDefaultView(DefaultView.Value);
                    }
    
    let me know if you have any questions
    Kind regards,
    Larry
  • 07-31-2013 07:20 AM In reply to

    Re: Opening a form based on a submitted view

     Thanks much Larry. I finally put together something similar to your solution. I added a hidden field to my submitted form called FormView and upon Submit I set that field to whatever view was being submitted. They I changed my Form Load rule to look at the FormView field value and then open the view I linked to it. My solution is a bit pedestrian, not as elegant as yours but it works for me.

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