4 Replies Latest reply on Mar 22, 2016 4:27 AM by keywords

    Scripting help


      I have a script that locates the proper record and goes to a field with a pop-up menu. and a drop down list  The desired result is that the first record is selected. There is a scrip that fires when the field is exited. I figured a commit record would do the trick to fire the script.




      Any ideas on how to choose the first record.  Once the record is chosen, the entry is removed from the list. Since the record are account numbers, the information in the record has no bearing on the outcome.

        • 1. Re: Scripting help

          hankshrier wrote:

          "… locates the proper record … The desired result is that the first record is selected"

          Are these not contradictory? If it already locates the proper record, why does it then need to select a different record? If you mean that you want it to go the "proper record", which is the first record, then have you tried using the Go to First Record script step?

          Once the record is chosen, the entry is removed from the list.

          This, too, seems a bit odd. Do you not want to do anything to the chosen record before removing it from the list?


          If you are still learning scripting, then a good way to proceed is to manually step through all the things you are trying to accomplish and write down each step you take (find a given set of records, go the first record in the set, go to X field, do some data entry from a list, omit the record, repeat with the next record, etc). Once you have that, you can try to write a script which does each of the steps you just did manually.

          • 2. Re: Scripting help

            I would also say that whether you're learning scripting or any programming language, keywords idea of writing down the basic steps BEFORE jumping in and trying to program something will almost always give you better results sooner.



            • 3. Re: Scripting help

              I've been doing this a long time.  The script does locate the proper record (a customer record) It does go to the proper field. When I do this by hand, I'm able to choose the first record from the drop down value list.  The list is based on related data. When an account is chosen and the field is exited. Upon exiting the field, another script fires and assigns the account to the Customer record and activates the account.


              The desired result is for the original calling script to enter the field, select the first account number, and then exit the field.  I can do everything except make the choice of the first account number.

              • 4. Re: Scripting help

                Forgive me if I am misunderstanding you, but as I see it a Value List is a list of data values that can be entered into a field, not a list of records that can be selected. If you want your script to select the first item from a Value List, you can use:

                GetValue ( ValueListItems ( Get ( FileName ) ; "NameOfYourValueList" ) ; 1 ).