#ADD
Create new content of the specified Content Type. The value for each field may be set inside the #ADD block with #ASSIGN, #NEW or #APPEND, where the variable corresponds to the field identifier.
Fields that reference content may be set as well. For a single reference, the value should uniquely identify the corresponding content (ie. OID=123). For multiple references, the value should be a comma separated list of values that uniquely identify each reference (ie. OID=123, OID=456).
Inside the #ADD block, $ID, $OID and $UUID will be equal to the corresponding values of the new record that will be created once the #ENDADD is encountered. This is useful when a script will need to know the ID of the content record just added (see example).
Prototype
#ADD($content_type, $folder, $username, $comment) ... #ENDADD
Parameters
- content_type - Which Content Type to add information to.
- folder - The folder to add the content under, which may be specified in one of the following formats:
- No Value - If no parameter is specified, the content will not be added to a folder.
- Field=Value - A folder ID, OID, UUID may be specified like OID=123.
- cPath - A cPath that resolves to a single folder or field.
- username - Username of the user that will be credited for adding the new content.
- comment - Additional text which does not effect functionality.
Example
#**
* Create Contact in folder with ID 2 as 'webcomand' user with comment
* "Web Site Form". Set FirstName and LastName fields and get the OID
* of the new Contact for later use.
*#
#NEW($FormName)#GET('Name')#ENDNEW
#ADD(Contact,2,'webcomand','Web Form')
#ASSIGN($Name,$FormName)
#ASSIGN($NewContactOID,$OID)
#ENDADD