AnsweredAssumed Answered

Creating records with scripts

Question asked by lowededwookie on Jul 31, 2014
Latest reply on Jul 31, 2014 by lowededwookie

Title

Creating records with scripts

Post

     I'm having a bit of an issue. I've been trawling through some forum posts here for an answer to what I'm trying to do and have worked it out. Kudos FMP forums. But I've struck an issue.

     So I have a script for "New Job Updates" that looks like this:

     

          Set Variable [$Update; Value:Job_Updates::Date]
          Go to Object [Object Name: "JobUpdate"]
          Go to Portal Row [Select; Last]
          Set Field [Job_Updates::Date; $Update]
          Perform Script ["Job Update"]

     The second script called "Job Update" I have opens a window and allows me to edit that record. It looks like this:

     

          Set Variable [$JobUpdate; Value:Job_Details::ID Job Updates]
          Go to Related Record [Show only related records; From table: "Job_Updates"; Using layout: "Job_Updates" (Job_Updates); New window]
          Show/Hide Toolbars [Hide]

     This works perfectly except for two things:

         
  1.           One of the fields in the Job Update record is a date field. If I create a new record in this through the Job_Updates layout the Date field is automatically filled with the current date. This is desired behaviour. This however does NOT happen when I use the script to create the record even though the actual field is set to automatically enter the date on creation.
  2.      
  3.           When the second script is run it seems that I can't edit any data because the main window is "editing" the record. How do I get the main window to not "edit" the record so that I can edit the record from the window triggered by the script. Currently I have to click onto the main window anywhere outside the Job Update window then go back into the job update window to edit. NOT desirable behaviour.

     Any ideas what's going on?

     Thanks folks.

Outcomes