2 Replies Latest reply on Jul 10, 2014 5:59 AM by philmodjunk

    Scripts, Help a newbie

    NeilEmerton

      Title

      Scripts, Help a newbie

      Post

           Hi all,

           I am totally new to file maker and databases if I'm being totally honest! I have heard how easy filemaker is to use and thought I would give it a trial to see if this is a possible solution to create a basic company database. Having spent a day playing with some of the basics I have tried to create a very basic conversion from a lead (prospect) to a quotation.

           I want the data that has already been created in the 'Lead' form (has its own table) to automatically be dragged into the quote form (separate table) to save re-entering the data that is common to both.

           I have created a button and started to white the script to achieve this. Everything was straight forward until I tried to populate the data. I have tried the "insert from last visited" function and tried the GetNth record (of which I don't think I was doing correctly) so after total frustration on what was, up to this point, amazingly simple to figure out I figured its time to ask some experts! Any help would be greatly appreciated!

           Obviously not yet knowing the technical terms to explain myself I have attached a screen shots below that hopefully shows enough information.

           I look forward to the 'education'!

           Many thanks in advance

           Neil

            

      Screen_shot_1_leads.png

        • 1. Re: Scripts, Help a newbie
          philmcgeehan

               One simple way of doing it, if you haven't got too many fields, is to Set Variables for each field in the Leads table you want to copy over.

               Then Go To Layout Quotes.

               Create new record.

               Set Fields with all the variables you have.

               Set Variable [ $ID ; Leads::Ref ]
               Set Variable [ $Contact ; Leads::ContactID ]
               Set Variable [ $Notes ; Leads::Notes ]
               Set Variable [ $LeadSource ; Leads::LeadSource ]
               ...
               Go to Layout [ "Quotes" (Quotes) ]
               New Record/Request
               Set Field [ Quotes::fk_LeadID ; $ID ]
               Set Field [ Quotes::ContactID ; $Contact ]
               Set Field [ Quotes::Notes ; $Notes ]
               Set Field [ Quotes::LeadSource ; $LeadSource ]
               ...
               Commit Records/Requests

          Also, I'd nearly always use the Set Field instead of Insert Text script step

          • 2. Re: Scripts, Help a newbie
            philmodjunk

                 But you really don't need to copy any data over beyond that of a contact ID. If you link your records by contact ID, once you have the value for contact ID in your Quotes field you can just add any fields you want from your leads table.

                 See this thread for a discussion of two methods for doing what you want. One copies over the data, one links to it. Neither require a script: Auto Fill