Hi - I am working on a set of forms that are all connected by a tabbed header (which is really a bunch of buttons). There are 10 tabs: 1 project form with 9 work request forms. Each work request will be associated with a project. On the project form, each tab will show a list of associated work requests in line with the tab name (so for example, if you click on the Photography tab, you see all the photography requests associated with that project). Once on the work request tab, you can click an edit button to edit a particular work request or create a new work request. Both will open an existing work request form. When the Create New button is clicked, it will pass some values related to the project into the work request form, close the project form and open the work request form with that tab highlighted. To our users, we are trying to make it look like the same form and so far I have all this working.
The struggle comes in when I am in the work request form and want to click on any tab (button) other than the project tab. I have setup the project button to look at the associated project and pass the values so that it opens up the correct project form. But I'd like the work requests tabs to bring me back to the project form and open it up to the view associated with the tab(button) that was just clicked. Here is the code that I use for the project form (and it works just fine):
//submit the Work Request Form
XDocument.DataAdapters["SharePoint Library Submit"].Submit();
//set the path to the project library and form
var LibraryPath = "http://sharepointsite/Projects%20List/";
var FormName = XDocument.DOM.selectSingleNode("/my:myFields/my:gpIdentifiers/my:FormTitle").text;
var FullPath = LibraryPath + FormName;
var objXDoc;
//open the project form
objXDoc = Application.XDocuments.Open(FullPath);
//close the original form
XDocument.View.Window.Close(true);
So for instance if I'm in Work Request Type A's form and I click on the Work Request B button, I'd like it to open the project form and switch to the Work Request B view so I can see all associated work requests of type B.
I created a field called ViewName, using the button to set the ViewName field to that of the desired view on the project form and passing that back to the project form. I can get it to pass the ViewName in, by adding a line of code, but I cannot get it to switch views. I tried adding an OnLoad event and that doesn't work because it passes the value after the project form has been opened and has already been loaded. I tried using form rules and the same thing happened.
Is there a way to do what I need to do? I really don't want to have to create the same views on 10 forms (yeah, I could create one and then re-save it 10 times, but that still seems like a lot of extra work, especially because I have to create each work request and publish it in order to get the fields from the work request to appear on the appropriate tab, so there will come a point where re-saving will not work and I'll be editing 10 different forms the same way) Or is there another way to approach this that I'm not thinking of?
Any advice/suggestions would be great.
Thanks!
Helen