4 Replies Latest reply on Mar 2, 2014 7:55 PM by mikebeargie

    Pulling data from one record to another

    colinmatthews

      Hi all,

       

      I have a layout for Product Sourcing where I track products, quotes, suppliers, lead times etc. From the records created we may proceed with just one supplier in ten. In this layout I detail each supplier's details.

       

      I would like a separate layout specifically for suppliers that we engage with so ideally I could have a button on the Product Souring layout (Create Supplier, for example) which then creates a record in the Supplier layout and pulls through the relevant details from the Product Sourcing record.

       

      I have tried the following and have come to a dead end:

       

      1. In the Supplier layout I have set each field to display data from the relevant fields in the Product Sourcing layout.

      2. Added a button to Product Sourcing with the script: New Window; Go to layout [Suppliers]; New Record/Request; Close Window

       

      I can see that I need to relate the PK and FK IDs from the two tables but can't figure out how to do that in the scripting. Can anyone help me out?

       

      Or, is there a better way of doing this?

       

      Many thanks,

       

      Colin

        • 1. Re: Pulling data from one record to another
          mikebeargie

          There are better ways of doing this:

           

          1) Just forget about the supplier table, and make a status field in the product sourcing table. Then you can run a layout script trigger to omit any "non-suppliers" when you go to a supplier layout.

           

          or

           

          2) Set up a script that exports the product sourcing record, goes to suppliers, and imports the record you just exported as a new record.

           

          or

           

          3) Set up a script that sets a list of variables of all the values you need to carry from product sourcing, goes to suppliers, creates a new record, and uses set field to set the values that you need in the new supplier record.

           

          carrying values through a relationship is clunky and context driven. Unless you have a need for a duplicate record in two tables, I'd suggest method 1 for simplicity sake.

          • 2. Re: Pulling data from one record to another
            colinmatthews

            Thank you Mike.

             

            I think I'll give option 1 a go.

             

            Colin

            • 3. Re: Pulling data from one record to another
              colinmatthews

              Hi Mike,

               

              I did as you said in option 1 and it is working great, thank you!

               

              One issue I am having though is when I leave the Supplier layout the records are omitted for all other layouts. I added a script for 'OnLayoutExit' to Show all Records which works in most layouts but in others I get an error message saying "No records match this find criteria", presumably because I still have the found set.

               

              How do I clear this found set so that the user can browse other layouts viewing all records?

               

              Many thanks

              • 4. Re: Pulling data from one record to another
                mikebeargie

                Try switching to onLayoutEnter script steps to show all records or to find for your non-suppliers. If you're going to have something setup like this (using a single table as two separate tables), you always want to execute actions in the context of the layout you are on/loading/viewing/going to.

                 

                You can use global variables to track the origin and destination layouts ( get(layoutname) should work if you name everything appropriately), thereby allowing you to leave a found set intact (IE if you are going from a supplier layout to another supplier layout), or to re-find if you're going to a non-supplier layout.