1 Reply Latest reply on Mar 26, 2017 6:27 AM by philmodjunk

    i want a script to add a new record for a related table

    ibrahimn

      hi all

       

      i have 2 tables

       

      jobs

      tasks

      i need when i'm on jobs details layout , press on a button let me add a new task with the same job no. i'm staying in automatically not let me choose or write the job no.

       

      how i can do that

       

      thanks alot

        • 1. Re: i want a script to add a new record for a related table
          philmodjunk

          This could be as simple as:

          Set Field [ Jobs::MagicKey ; "" ]

          Set Field [ tasks|magicKey::_fkJobID ; Jobs::__pkJobID ]

           

          This would require setting a MagicKey relationship between the two tables:

          Jobs::MagicKey = Tasks|MagicKey::__pkTaskID

          Where __pkTaskID is either an auto-entered serial number or auto-entered get ( UUID ) with allow creation enabled for Tasks|magicKey.

           

          Other methods set a variable to the job ID. Switch layouts to a layout based on tasks, creates the new record and sets the new task record's job ID to the value of the variable.