1 Reply Latest reply on Feb 28, 2012 7:12 AM by philmodjunk

    Script Action Based on Newer Related Records

    DavidLake

      Title

      Script Action Based on Newer Related Records

      Post

       

      I trigger my checkin script with a button on the portal line.  The portal shows by in/out transactions.  The script simply sets the check in date on that transaction and resets a master record flag as "available".

      Sometimes there are multiple related/transaction records with empty check in dates and I'd like to halt my script IF there is a newer / more current related record already in the system.

      How can I check for the condition of "newer related records" before continuing the script?

        • 1. Re: Script Action Based on Newer Related Records
          philmodjunk

          It would help to see your script.

          In general, you can use sorting to sort your records by date so that the most recent date is first. Sort orders can be defined in relationships, in which case the most recent record will be in the first portal row and calculations that refer to the related table will reference the most recent related record. If you pull up these records in a found set, they can also be sorted so that checking the first record in the found set will tell you if there is a related record with a more recent date.