1 Reply Latest reply on Mar 15, 2014 7:44 AM by philmodjunk

    Inserting a row in a portal

    smokey

      Title

      Inserting a row in a portal

      Post

           I'm interested in inserting a row in a portal.  I had asked this question before and was told that the best was to do a script, and that's the way that I'd like to do it.  However, I tried it and, after going through the options, I wasn't able to find the correct way to accomplish this.  Can you be more specific with the details of how to get this done

           Thank you very much..

        • 1. Re: Inserting a row in a portal
          philmodjunk

               There are two ways to add a record to the portal's table:

               1) Enable "Allow creation of records via this relationship" for the portal's table in the relationship on which the portal is based. This adds an extra blank row to the portal where you can create a new portal record just be entering data into one of the fields in this row. No scripting required.

               2) Write a script: (Subsitute your table and field names for the names used in this example.)

               Set Variable [$ID ; value: LayoutTable::PrimaryKey ]
               Go to Layout ["PortalTable" (PortalTable) ]
               New Record/Request
               Set Field [PortalTable::ForeignKey ; $ID]
               Go To Layout [Original Table]

               Both methods have their pros and cons. 1) is simplest to set up but adds that extra row to the portal which isn't always desirable. With larger numbers of portal records, it requires scrolling the portal to the bottom before you can add a new record. 2) Avoids those issues and the portal can be set up to show the newly added row at the top of the portal, but the change in layouts can trip many different script triggers.