The Add Object Record command adds a specified object to the database. The class of the object may be either an instance of a folder or an attached document. Optionally, the object field values may be specified with a list of field name and value pairs.
Add Object Record
of type object_type
[with fields list_of_field_values]
Example: Add a folder type document to Virtual Ticket.
tell application "Virtual Ticket 8.0"
if (not (Exists Object of type "Catalogs" with id "Nature")) then
set fields to {¬
Catalog_Title:"Photo Disk No. 38 - Objects of Nature"¬
,Source:"PhotoDisk"¬
,Created_By:"Sarah McDonnely" }
set objectIdRecord to Add Object Record of type "Catalogs"¬
with fields {|ID|:"Nature"} & fields
end if
end tell
Example: Add an attached document to Virtual Ticket.
tell application "Virtual Ticket 8.0"
-- Adds a document of type Change_Order to the Job 100
set m to "Customer authorizes changes and agrees to pay $500.00"
Add Object Record of type "Change_Order"¬
with fields {Folder_ID:100, Change_Order_Note:m}
end tell