4 Replies Latest reply on Jun 15, 2015 9:44 AM by gavjuan

    Restrict number of records for a portal



      Restrict number of records for a portal


      I have an invoice layout with a portal that can display a miximum of 22 records. I would like to restrict the number of related records to the same number (22). Does this have to be done within the script that is adding new records to the portal or is there a simple limit setting? I'm using a portal rather than fields as the records need to be slid up and down within the portal when the values and data are entered and invariably updated.

        • 1. Re: Restrict number of records for a portal

          How are you creating the portal records? If you are creating them directly in the portal row by entering data into the blank "add" row, simply limit your portal to 22 rows and don't include a scroll bar.

          Or you can remove that option, use a script to add the records that first counts the current number of records (with the Count() function) to determine whether to allow this.

          But you really shouldn't need to limit the invoice to 22 rows in most circumstances. There are ways to print the typical invoice with related line items from a list view layout based on the portal's table that is not limited to a specific number of portal records.

          • 2. Re: Restrict number of records for a portal

            Records are added with script (attached). If the portal surpasses 22 records the layout would have to run to 2 pages and I want to prevent that. I was hoping the portal would have a facility to cap the number of related records - I guess I'll need to add it my script?

            • 3. Re: Restrict number of records for a portal

              What's your end goal? To only ever allow 22 line items for an invoice?  Most people recommend to not print from a portal but to do as Phil says and print from a specific print layout.  Here you could use merge fields and sliding to get everything to fit, and right where you want it to display.

              But for portal limiting, in your script, you could start with and If statement and check for the count of related records.  If it exceeds 21, then you can branch to end the script, or delete a line item and add a new one. 

              I don't like either options, which is why I initially ask, why only 22 line items?

              • 4. Re: Restrict number of records for a portal

                Yes, a maximum of 22 lines and we do use a PRINT layout. It's at the data entry stage that occasionally someone will not amalgamate some costs and inadvertently create records that are omited from the print. I can add it to the script, just thought a cap would be useful?