ATC: COPY KEY dataPK | [doctype] project document supplemental; WITH option
This command creates a new document, usually by copying a source document. The DocCopyConfig rules are applied. After this command, the new document is selected as the current document.
- KEY dataPK; is required if [doctype] project document supplemental is not used. [V2017+]
- dataPK specifies the doc master key or dataPK for a document.
- ; (semicolon) is required.
- [doctype] project document supplemental; is required as described if KEY dataPK is not used.
- [doctype] is optional; however, if used, requires square brackets. It specifies the source Doc type by name or internal key. Doc type names are case-sensitive. If you don’t include a doctype, the Doc type of the current document is assumed.
- project is required. It specifies the Project ID. You can use an * to specify the same project as the current document.
- document is required. One of the following can be used:
- doc num specifies the source document number of an existing document to be used as a template and copied.
- = (equal sign) indicates that the current document should be copied. As you might expect, the closed and status fields are not copied.
- NEW indicates that a new document should be created instead.
- supplemental is optional and rarely used. It specifies either a batch number or the contract ID.
- ; (semicolon) is required.
- WITH option is optional. There are several options that can be used singularly or together, separated by spaces.
- ATTACHMENTS copies the attachments on the source document to the new document.
- AttachmentFilter filterexpression; [V2017+] copies the attachments on the source document that match the filterexpression to the new document. Use .NET Data Expression syntax for the filter, but your filter cannot contain a semicolon, even if quotes. End the filterexpression with a semicolon if this clause is not last.
- AUTOACCEPTED specifies that the creator of the document (always copied form the current document) at Seq. 1 should be recorded as having accepted the route so the document is sent on to Seq. 2 immediately.
- CURRENTITEM limits the Items copied from the source document to the one matching the current iteration of the ATC: FOREACH command. If used, neither ITEMS nor ITEMFILTER can be used.
- DUE n specifies the number of days in which the new document is to be due. The default of this option if not specified is to use the value set up by the System Administrator.
- ITEMFILTER filterexpression copies the Items on the source document that match the filterexpression to the new document. If used, neither ITEMS nor CURRENTITEM can be used. Use .NET Data Expression syntax for the filter, but your filter cannot contain a semicolon, even if quotes. End the filterexpression with a semicolon if this clause is not last.
- ITEMS copies the Items on the source document to the new document. If used, neither ITEMFILTER nor CURRENTITEM can be used.
- UNSAVED leaves the new document pending its first save. Be sure to include an ATC: SAVE
- LINK or ASSEMBLED or INCLUDE how
- LINK links the new document to the source document (as an additional attachment).
- ASSEMBLED Requires “NEW” option (above) and attaches the new document to the source document as an additional assembled attachment. You should also save the source document.
- INCLUDE how Requires “NEW” option (above) and attaches the new document to the source document as an additional attachment and sets the include flag to 1 or P (for PDF) or (0 for Not Sent). You should also save the source document.
- ROUTE routelist; specifies the routing for the new document. The default is to apply standard routing rules. The routelist can contain any of the following, but at least one element is required. The ; (semicolon) is required.
- routename specifies a predefined route name. Multiple route names can be separated by commas.
- AUTO selects the route based upon standard routing rules.
- PER SOURCE, if used, must begin the route-list. This option copies the routing from the source document. You can also specify * or = as shorthand for this option.
The ATC: COPY command takes about a second to run, partially because it must resolve and create all the parts of the document. This includes TO and FROM addresses by default, even if you do not show the Address tab on the document. If you do not make use of certain address types (such as To and/or From), you can improve performance by adding the ExcludeCommonChoices | AddrType rule for the target Doc type, along with adding AddrType codes (in the Code Maintenance tool on the Manage Dashboard) for any specific address types that you do require.
ATC: COPY * =; WITH ATTACHMENTS
The above example means “create a document identical to the current document in the current project and include the document attachments.”
ATC: COPY [Pay Request] * NEW; WITH INCLUDE 0 ATC: SET Title = Another Pay Request ATC: SAVE ATC: * the new title ATC: SELECT SOURCE ATC: SAVE ATC: * the attachment relationship
The above example means “create a new Pay Request document for the same project as the source document. Create the document as new, not copied from another document, attach the new pay request to the current document “not included”. Set the title on the new document, and save the new title. Select the original document and save it in order to persist the attachment relationship between the documents (otherwise the document will require the user to save).”
ATC: COPY [Submittal] GC12400 2; WITH ROUTE PER SOURCE APVouch1;
The above example means “create a new Submittal document by copying document number 2 in project GC12400. Route the document according to the predefined route APVouch1 from the source document.”
ATC: COPY [Meeting Min] GC123 7; WITH ATTACHMENTS ITEMS LINK DUE 99 AUTOACCEPTED
The above example means “create a new Meeting Minutes document by copying document number 7 in project GC123. Include attachments and Items from the source document and link the new document to the source document as an attachment. Make the new document due in 99 days. Send this new document on to the routee in Seq 2 immediately.”
ATC: FOREACH DocAttachedFile BY FileName ATC: SET $From = @.AttachedDocMaster ATC: COPY KEY $From; WITH ATTACHMENTS ITEMS ATC: SELECT Source ATC: ENDLOOP
The above example means “for each attached document, set the $From variable to the document’s master key, then use that key in the copy command to copy the document with attachments and items. Then select the source document (that has the attached documents) again to repeat the loop.”
Last updated: February 18, 2021 at 15:02 pm; green text = new