5 Replies Latest reply on Nov 20, 2014 11:22 AM by philmodjunk

    Trouble with Popover



      Trouble with Popover



      I am having a hard time getting a popover to work. I have two tables (Transactions and Vendors). They are related to each other. 

      If anyone could shed some light, I would appreciate. 

      1: In my db I have in my main layout (transactions) fields that are related from a different table (for all transactions, we enter the details of the vendor. At principle. I created a popover with a slide control (2 slides). On the first a portal with the list from all vendors. When you enter the transaction you can open the pop over and search for the company you want then just click on it to make it stick on the layout. 

      2 The second slide is a follow up from the first. Want to add vendors in case the vendor is not on the list. I have a button on the first slide where I have added a script to create a record in the vendors table. But there is where my problem starts. The script is wrong and therefore not working. Every time click on it it actually create a record on the main table not on the vendors table. 

      My intention is to when a company is not listed, the user can enter the information straight from the popover. 

      My tables

      transactions ---< Vendors 

      transactions ---< Vendors2 (relationship used for the portal inside the popover to display the list of companies and once a company is clicked, then it transfer the company to the Vendors field in the Transaction layout)

      Any help is appreciated. 



        • 1. Re: Trouble with Popover

          Your script would need to do this to create a new vendor record:

          Go to Layout ["vendors" (Vendors) ]
          New Record/Request
          Go to Layout [originalLayout]
          Go to Object ["objectName of New Vendor slide Panel goes here"]

          You'll need to add the slide control panel's object name so that the popover is re-opened once the script returns to the original layout.

          And you'll need to use one of two methods with this: Collect data about the new vendor in global fields, then add set field steps after new Records request in the above script to set the fields of the new record to the value of these globals or Set the ID of the new Vendor record to a variable so that a field in your Transactions layout can be set to this value so that the "new vendor" panel fields can use a third relationship based on this ID to access the correct record.

          • 2. Re: Trouble with Popover

            Hello Phil, 

            Thanks for the reply. I decided to use global fields with the script. (as seen below). Checking with the debugger, it goes smoothly, however, although it creates a new record, it actually replaces all the fields of an existing record (ie. it creates record 50, but cleans up the fields of the record which is live on the main layout. 

            I am little confused. What am i doing wrong?


            Thanks once again




            • 3. Re: Trouble with Popover

              You need to stay on the portal table's layout until all the set field steps are executed, then use go to layout and go to object to return to the popover.

              • 4. Re: Trouble with Popover

                Thanks once again Phil for your valuable help! It works...however I mande some changes, I was not able to achieve my intented using one popover and 2 slides...I am still using the global fields though and it works (some more housekeeping to clean up global fields). But it is all goot at this point. 

                What I have done now is. On the main layout (transactions), I have a the _kp_vendors_ID, with a dropdown list pulling the vendors names to pull the info about the company and fill the blanks (Company Name, Tax Numbers, Contat and Phone). If the company is not on the list, then a popover button is available to allow the user to enter info of the new company. 

                But, now it would be nice, once the new info is entered, onScritexit, this new information be set on those fields on the main layout, whithout the user having to go to the dropdown list and look for that company...

                Any ideas, how my script would look like in this case? I have tried with an examplo from the Start Solution (invoices), but it is not working the way i intend. 

                Thanks once again.


                • 5. Re: Trouble with Popover

                  The script should be able to use Set field to set that drop down list field to the needed value. Just use Set variable to copy this value from the new record to a variable first after the new record was created so that a step near the end of the field can use this variable with set field to update the other field and thus link the current layout record to this new related record.