Nav view search

Navigation

Search

The Exchange

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

Back

Copy Records in Virtual Ticket with MetaScript

Use MetaScript to copy folder and document type records in Virtual Ticket.

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

Sometimes a record for a folder or document type may need to be duplicated wholly or in part to create a new record. For example, a job may be repeated from month to month with just adjustments in the dates associated with the job. In these cases, a copy operation on a form under the folder or document type can save time and reduce the chances of user error introduced by rekeying data.

Any record can be copied via MetaScript using the CopyTicket function found in copy_ticket.js:

Parameters

CopyTicket (<data_type>, <source_id>, <target_id>, <include_documents>, <fields_to_exclude>, <documents_to_exclude>, <fields_to_set>);

  • <data_type>
  • <source_id>
  • <target_id>
  • <include_documents>
  • <fields_to_exclude>
  • <documents_to_exclude>
  • <fields_to_set>

CopyTicket returns an object with the value of the identifying field in the new record that was created.

Example

var new_job = CopyTicket('Jobs', 1, null, true, [ "Due_Date", "Ship_Date"], [ "Changes" ], { "Entry_Date" : ServerDate(), "Status" : "Pending" } ;    
 
alert(new_job.id); 


To use the example: 

  1. Download the form library.
  2. Import the form and scripts into Virtual Ticket.
  3. Create a new record with the form. Click the duplicate button to have the record duplicated. The Go button can be clicked to view the duplicated record.

Note: Field names used in the script above are case-sensitive. 

Resources

  • Download and install a sample form illustrating this Toolbox Snippet (see below).


Last Modified:

2011-09-30

by

Justin Bierman