Nav view search

Navigation

Search

The Exchange

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

Back

Creating New Records with MetaScript

Create new document type or folder type records using MetaScript.The MetaScript function CreateTicket() is used when you want to programmatically create a new record for a Document Type or Folder Type.

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

The CreateTicket() MetaScript function is used to create a new record in the database for a document type or folder type.

Parameters 

CreateTicket( object_type, ticket_id, field_data )

  • object_type: What kind of a record you wish to create.
  • ticket_id: If this is an autonumbered field, you must use null for this parameter. Otherwise, use the ID you wish to create.
  • field_data: This is for information you wish to be saved with the record.For example, if you want the Request_Number saved to a same named field, you would use {Request_Number: Field( 'Request_Number' )}

Example

var result = CreateTicket("Jobs", Field( 'GR_Number' ), {"Job Name" : Field( 'Job_Name' ), "Description" : Field( 'Job_Request_Descript' ), "Customer Code" : Field( 'Customer_Code' ) });  
 
if ( result.id !== undefined )  
    {  
        alert("A job with the same GR Number has been created.");  
    }  
    else 
    {  
        alert("Job creation failed.");  
    }  
 

To use the example: 

  1. Download the library file (see below).
  2. Import the form and scripts into Virtual Ticket.
  3. Create a new record with the form. Click the Create Ticket button to have a new record created.

Resources

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

Last Modified:

2011-09-28

by

Justin Bierman