webCOMAND

#EDIT

Modify existing content.  If a Content Type contains more than one record with the unique value used to reference it, #EDIT will choose the content closest to the Publication Destination Content Folder with that field value.

The value for each field may be set inside the #EDIT block with #ASSIGN, #NEW or #APPEND.

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 #EDIT block, $ID, $OID and $UUID and all other fields will be equal to the corresponding values of the existing record.

It is possible to edit content locked/opened by a user, if that same user is the one publishing/processing the script used to edit the content.

Prototype

#EDIT($content_type, $unique_value, $username, $comment) ... #ENDEDIT

Parameters

  • content_type - Which Content Type to add information to.
  • unique_value - A value to uniquely identify the content record to be updated. It can be the value of the first content type field marked as a Unique/Key, or a field=value pair (ie. OID=10).
  • username - Which webCOMAND user account will be credited for adding the new content.
  • comment - Comment about this update that does not effect the content object, but will appear in the version notes for this edit.

Example

#/ Modify Contact with OID of 2
#EDIT(Contact,OID=2,'webcomand','Web Form')
    #ASSIGN($FirstName,$GetFirstName)
    #ASSIGN($LastName,$GetLastName)
#ENDEDIT

Related

#ADD