REMOVE_OBJECT

Use the REMOVE_OBJECT script function to delete an existing object. The deleted object is moved to the Recycle Bin, from where you can restore it if necessary.

Tip: Use the :ON_ERROR script statement to define actions to be taken if the removal fails. For more information, see Script Elements for Error Handling.

Important Considerations

Keep the following rules and behaviors in mind when using this script function:

  • This script function writes all open transactions of the script to the AE database. For more information, see Script Processing.
  • You cannot use REMOVE_OBJECT to delete a folder.
  • Do not use this script function to remove Users, as it does not check if there are active tasks from the User. Use the Automic Web Interface to remove Users.

Syntax

REMOVE_OBJECT (Object Name)

Parameters

Parameter Description Format
Object Name Name of the object to be deleted. Script literal or script variable

Return Codes

The script function returns the following codes:

  • 0: Deletion was successful.
  • 20645: This object does not exist.
  • 20217: This object is currently open for editing purposes.
  • 20369: The object is in the Transport Case.

Examples

This following example deletes the object "FIRM.CALENDAR2022":

:SET &RET# = REMOVE_OBJECT("FIRM.CALENDAR2022")

See also: