5 Replies Latest reply on Nov 7, 2011 9:40 AM by philmodjunk

    Add New Record layout navigation script

    MikeF

      Title

      Add New Record layout navigation script

      Post

      Need to finesse an "Add New Record" script that states:

      If on current layout, then simply add a new record.

      Else open New Window, go to layout [Meeting_Summary] and Add New Record.

       

        • 1. Re: Add New Record layout navigation script
          philmodjunk

          I'm not sure I follow that. "current layout" will always be the current layout at the point in time that the script executes so your script will always be "on current layout".

          If you need to check the name of the current layout, you can use code such as:

          If [Get ( LayoutName ) ≠ "Meeting_Summary" ]
             Go To Layout [Meeting_Summary]
          End If
          New Record/Request

          • 2. Re: Add New Record layout navigation script
            MikeF

             Phil,

            Merely trying to have one script accomodate a couple of different layouts.

            For various reasons, meetings need to be added or edited only in in layout Meeting_Summary.

            So if I'm currently in layout Meeting_Overview and want to add a meeting, need the script to open a new window and load layout Meeting_Summary.

            If I'm currenly on Meeting_Summary, just want to add a new meeting from that layout/window.

            Thanks,

             - Mike

             

            • 3. Re: Add New Record layout navigation script
              philmodjunk

              Forgot a step for the new window.(I usually just change layouts in windows system to avoid window resizing that can take place.)

              If [Get ( LayoutName ) ≠ "Meeting_Summary" ]
                 New Window [//specify window parameters here]
                 Go To Layout [Meeting_Summary]
              End If
              New Record/Request

              • 4. Re: Add New Record layout navigation script
                MikeF

                 Phil,

                That works, except I've been also been attempting to pass the __kp_ProjectID from PROJECTS into the _kf_ProjectID in MEETINGS, both number fields.

                Tried using a variable, but am not having any luck.

                Any assistance would be greatly appreciated.

                Thanks,

                 - Mike 

                • 5. Re: Add New Record layout navigation script
                  philmodjunk

                  You may be able to use:

                  Set Variable [$ProjectID ; Value:Projects::__kp_ProjectID]

                  but that assumes that you are on a layout that lists "Projects" in Show Records From in Layout Setup...

                  And that may not always be the case. Obviously, it won't when you are already on the Meeting_Summary layout here.

                  You might try passing the ID number as a script parameter if you are using a button or script trigger to perform this script.

                  That way you can put an expression, appropriate to the current layout, in the parameter box that returns the needed ID.

                  Then you can have a script that looks like this:

                  f [Get ( LayoutName ) ≠ "Meeting_Summary" ]
                     New Window [//specify window parameters here]
                     Go To Layout [Meeting_Summary]
                  End If
                  New Record/Request
                  Set Field [Meeting_Summary::_fk_ProjectID ; Get ( ScriptParameter ) ]