5 Replies Latest reply on Jul 24, 2015 9:39 AM by SteveMartino

    Add Foundset to Portal in another table (with line items)

    AndrewJudd

      Title

      Add Foundset to Portal in another table (with line items)

      Post

      Hi all, I'm working on a script to add a foundset of records to a portal in another table.

      It's more difficult than normal as this portal uses a line items system to allow the same record (in my case artworks) to be on multiple lists.

      I'll include images of what I have so far for this script. At the moment when you run the script it just adds one record to the portal (in PRICE LIST).

      To summarise... can any one suggest how I can be in my "ARTWORK" layout and take a foundset directly to a portal (which itself is in "PRICE LIST") that portals information from "PRICE LIST LINE ITEMS".

      Graph attached too.

      Not sure I can use replace field contents in this case.. ?

      thank you!

      Screen_Shot_2015-07-24_at_12.02.42.png

        • 1. Re: Add Foundset to Portal in another table (with line items)
          AndrewJudd
          /files/7957c8de77/Screen_Shot_2015-07-24_at_12.08.41.png 612x233
          • 2. Re: Add Foundset to Portal in another table (with line items)
            SteveMartino

            I think first would be best to describe why you need to do this?

            If I understand, you have a found set of records, with related records.  You want to grab this found set of records, and all their related records, and move them to another table, and put them in a portal.

            Or

            You just want a found set of records to show up on a portal in another table. 

            If it's this second one, I would think the portal you want the records to show up on could just be another relationship, of duplicated TOs, filtered by a foreign key you put on those records. IOW, the filtered portal or relationship will only show records that are related to the records you marked.  I know I didn't explain what's in my head correctly, but let me make sure I'm on the right track to identifying the problem

            Although, if what you have works properly for one record, then you could just wrap your script in a loop that will go to the next record and repeat.

            • 3. Re: Add Foundset to Portal in another table (with line items)
              AndrewJudd

              Thank you, the idea is to add an alternative (and quicker) way for a user to make a price list.

              At the moment the user has to go the PRICE LIST and click a popover which displays a portal to artwork and select which artwork to add one by one. It would be great for a user to flag what they want to add while in artwork and then click a button to add the lot to a price list in one go. I have set up invoicing in this way and that works fine - however this is much easier as artworks can only be on one invoice at a time. So there is a direct relationship between invoices and artwork. Attached is my invoice script which works fine. I want to apply this logic to price lists.

              I wondered about the loop idea, how do I implement this I've not used it before.

              thanks

              • 4. Re: Add Foundset to Portal in another table (with line items)
                AndrewJudd

                Hi Steve, I now have the first two artworks in a foundset being added with the below script.. Do you know how to make them all get added?

                • 5. Re: Add Foundset to Portal in another table (with line items)
                  SteveMartino

                  First, make a duplicate copy of your script.

                  If I understand what you are doing, your loop is in the wrong spot.

                  Lets say the parent record has 5 records with multiple child records

                  Generally you should, starting from your found set of records.

                  Go to record/request/page [first]

                  Loop

                  Set your variables// from the parent record you are on

                  Go to the layout you want (or the related record) in a new window.

                       Loop

                                 Do your set fields

                                 Go to Record/Request/Page [next, exit after last]

                         End Loop

                  Close window // your done with the child records, close the window

                  Go to Record/Request/Page [next, exit after last] // this is for the parent records

                  End Loop

                  This is the very basic concept, but you have to watch it in the debugger to make sure it is performing as you want it.