Link to home
Start Free TrialLog in
Avatar of rvfowler2
rvfowler2Flag for United States of America

asked on

FM - Setting Timestamp Field Based on Another Field set via a Script

This is really hard to test as I have a lot of scripts run off of my Status field.  Already searched EE and FM Help.  I want a timestamp field to be filled with the current date/time anytime there is a modification in my Status field.  This seems easy - just put a script trigger on OnOjbectSave.  However, what if the field is set in a script.  I think this bypasses the trigger.  I have so many scripts that alter this field (Retain, Retire, or Refer status) that it would be nice if I could just set the timestamp field to alter anytime this status field alters.  I thought of doing this via the field's properties AutoEntry, but my understanding is that these fields only run on record creation and not any time in the future when the field might be modified.  Suggestions?
ASKER CERTIFIED SOLUTION
Avatar of Will Loving
Will Loving
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also, you might want to consider an audit trail for Status, which tracks what field was changed and when. Check out this video tutorial from John Mark Osborne on Object Script Triggers. The whole video is a good introduction to an explanation of the differences between the various triggers, but at just before the 10 minute mark he shows how to create an audit trail.
Sorry, I meant the "Do not replace existing value of field (if any)" checkbox.
Sounds like a cool video, I don't see the url though. Thanks!
Avatar of rvfowler2

ASKER

Thanks, I'll look into the video.  Easier than I thought.  But I created 3 timestamp fields so we can have a record if somone moves from retain to refer and then to retire.  So, can you do the calc like this?

If (Status = "Retain";
Let (
RetainStamp = Status ;
Get (CurrentTimeStamp)
)
)
Yes, doing it conditionally works (at least on my test)
Yes, it worked, thanks, but I'm having a hard time understanding it in English.  Let sets a variable and then uses it in a calc after the semicolon.  However, here, it seems that the entirety of the calc is simply Get (CurrentTimeStamp), so the variable, or in this case the field, is equal to the timestamp since it is equal to whatever comes after the semicolon.  Did I say it or explain it correctly?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.