9 Replies Latest reply on Mar 23, 2011 2:50 PM by brian.curran

    A layout within a layout, how do I add a 'New Record'?

    brian.curran

      Title

      A layout within a layout, how do I add a 'New Record'?

      Post

      Hi,
      I have a multi-tabbed dashboard that helps me to keep track of customer details, services, suppliers etc. On one tab, I have a portal that displays all the people associated with that particular customer.

      This works fine but I have to leave the dashboard layout and go to the 'Contacts' layout to enter details for new people. I tried copying all the fields from one layout to the other but I'm not sure how I can choose to enter a new contact for the customer.

      Does that make sense?

      When I'm in the Contacts layout, I can simply choose 'New Record' to add another contact but I can't do that in the Customers layout, as it would just add a new customer...

      Thanks

      Brian.

        • 1. Re: A layout within a layout, how do I add a 'New Record'?
          ryan

          There are at least 2 ways of accomplishing your goal:

          1.  In your relationship between the Customer Table and the Contacts Table, check off the option under the Contacts table/side to "Allow creation of records in this table via this relationship."  This will allow to remain on the Contacts layout and add a new Contact via the portal. 

          2.  Another possibility is to place a button near the portal to "Add a Contact".  A script can be linked to the button that opens a window in the contact layout, for example, and auctomatically creates a new record, etc.  This option is nice if you have more fields to fill out for a contact than you can fit or show in your portal.

          • 2. Re: A layout within a layout, how do I add a 'New Record'?
            brian.curran

            Thanks for your suggestions, I had the first one ticked already but it meant that I had to add new records using the portal which as you say, can limit the number of fields displayed.

            The second one would suit me better I think, just not sure which script option to choose so I'll have a look at it now...

            • 3. Re: A layout within a layout, how do I add a 'New Record'?
              brian.curran

              I've added a button and specified the following script:

              Script Name: Add Contact
              Go to Layout ["CONTACTS" (CONTACTS)]
              New Record/Request
              Halt Script
              Exit Script [] 

              Another button takes me back to the 'dashboard' but I'm not sure how to direct myself back to the original tab:

              Script Name: Return
              Go to Layout ["DASHBOARD" (DASHBOARD)] 
              Halt Script
              Exit Script [] 

              Any ideas on how to specify a tab or maybe a suggestion for a better way of doing the above?

              Thanks
              Brian. 

              • 4. Re: A layout within a layout, how do I add a 'New Record'?
                philmodjunk

                You can remove the halt script and exit script steps from both, they aren't needed.

                Use the insepctor's name box on the position tab to give each tab an object name.

                use the OnObjectModify trigger for the tab control to save the object name in a global variable when click a tab.

                Then use Go To Object [$$yourglobalvariable] to reselect the tab you had previously selected. This can be set up with an OnLayoutLoad script trigger if you want.

                • 5. Re: A layout within a layout, how do I add a 'New Record'?
                  brian.curran

                  Thanks, I'm not sure I've got the OnObjectModify trigger right...

                  I typed 'People' in the Inspector name box and then right clicked the People tab and chose 'Set Script Triggers'. I ticked the 'OnObjectModify' checkbox and specified a script called 'People'.

                  The 'People' script contains the following:
                  Set Variable [$$People]

                  I have a button on the 'Contacts' layout (to return me to the 'People' tab on the Dashboard layout)
                  I'm not sure what to type in this 'Return' script, so far I have:

                  Script Name: Return
                  Go to Layout ["DASHBOARD" (DASHBOARD)]
                  Go to Object[$$People] 

                  This returns me to the dashboard but not the People tab. I'm also not sure what you mean by an OnLayoutLoad script trigger...

                  Thanks
                  Brian. 

                  • 6. Re: A layout within a layout, how do I add a 'New Record'?
                    philmodjunk

                    To set an object name on a tab, you must first select it, then type in the object name. You appear to have done the opposite. That may have assigned the object name, "People", to a different object on your layout.

                    If you always want to see the "People" tab selected when you return, you do not need the variable, you can just use Go To Object ["People"]. This assumes that you have correctly assigned this name to your tab. In layout mode, if you click an object, its name will appear in the name box in the Inspector, so this is easy to double check.

                    • 7. Re: A layout within a layout, how do I add a 'New Record'?
                      brian.curran

                      I'm pretty sure I have the Tab named correctly. In layout mode, I clicked the tab to select it then clicked it again to put a selection box around the actual tab, then I typed 'People' into the Inspector Name box.

                      People_Layout

                      Assuming that I have the above correct:

                      On the 'Contacts' layout, I went to Button Setup and chose 'Go To Object'
                      Then clicked the Specify button and typed "People"

                      Contacts_Layout

                      It still doesn't work so I must be missing something simple...

                      Thanks
                      Brian. 

                      • 8. Re: A layout within a layout, how do I add a 'New Record'?
                        philmodjunk

                        Yep, you have the tab named "People".

                        Your button, however, is located on a different layout.

                        You need to create a script with two steps:

                        Go To Layout [//select layout with tab control]
                        Go To Object ["People"]

                        Your button would then use the perform script option to run this script.

                        • 9. Re: A layout within a layout, how do I add a 'New Record'?
                          brian.curran

                          Ah, that is blindingly obvious now! It works perfectly...
                          Thanks Phil :)