1 Reply Latest reply on Mar 2, 2012 7:17 AM by philmodjunk

    Triggering a Script Upon Creating a New Record



      Triggering a Script Upon Creating a New Record


      I would like to set a number field to a specific numeric value when the user first creates a new record. My script looks as follows:

         Set Field (Job Profitability::Overhead %; .12)

      This script is supposed to place the numeric value of ".12" into the field "Overhead %" when the user creates a new "Job Profitability" record.

      I went to the Layout Setup Dialog Box and set this script to run when "OnLayoutEnter" but nothing is happening. Also, I'm not sure that this is the appropriate way to handle, because I only want the numeric value set upon creating a new record.

        • 1. Re: Triggering a Script Upon Creating a New Record

          Your script will modify whichever record is current the first time you access the layout where you set up this trigger. That is very likely to modify records that you do not want to modify in this fashion.

          There isn't a trigger that is tripped only when a new record is created. Fortunately, entering a default value such as this does not require a trigger nor any scripting.

          Open Manage | Database | fields and find the Overhead field.

          Double click it to open field options.

          Click the auto-enter tab and type in 0.12 into the data box.

          Now every new record in the Overhead table will automatically receive this value when it is first created.