Nav view search

Navigation

Search

The Exchange

The place to download pre-configured tickets, code snippets, and solutions

Back

Recording the Time and Date When a Record is Opened for Editing

Use a Global MetaScript to record the time and date whenever a record is opened for editing.

Note: This solution is optimized for Virtual Ticket Developer.

If you are using Workgroups DaVinci and are planning to use a Toolbox snippet not marked as DaVinci-compatible, please check with Support for possible compatibility issues before using.

Introduction

By using an event listener in a form's Global MetaScript, the current server time and date can be recorded whenever a record is opened for editing.  

By recording the time and date of the server, you can eliminate any disparity between individual client computer clocks and that introduced by client computers in different time zones.

Note that this snippet is part of a series that explores different ways of recording time.  See Toolbox Snippet - Time and Date Series Snippet Index for other related methods.

Description

The following Global MetaScript can be used in a form to capture the server time and date whenever a record is opened and put into edit mode.

//@version "2.0"  
 
Form.addEventListener("editingStarted", RecordEditStartTime);  
 
function  
RecordEditStartTime( aEvent )  
{  
 if(Form.objectState == "existing")  
   {  
      SetField("TS_922_OpenEditTime", ServerTime());  
      SetField("TS_922_OpenEditDate", ServerDate()); 
   }  
}  
//"TS_922_OpenEditTime" and "TS_922_OpenEditDate" above should be changed to the names of the fields you will use to store the recorded time and date. 

Resources

Last Modified:

2011-10-06

by

Chris True