Automation Engine Script Guide > Ordered by Function > Activate Objects > DEACTIVATE_UC_OBJECT

DEACTIVATE_UC_OBJECT

Script Function: Deactivates a completed task.

Syntax

DEACTIVATE_UC_OBJECT(RunID [, FORCED])

Syntax

Description/Format

RunID

The RunID of the task that should be deactivated.
Format: script variable, script literal, number without inverted commas

FORCED

Performs deactivation regardless of the status of the high-level tasks.

The system will not check whether the task runs within a workflow. Also, the options for the automatic deactivation of all subordinate tasks are ignored and deactivated in any case. You can use FORCED only in combination with workflows.

Note that FORCED does not check whether tasks in sub-workflows are active.

Format: AE name, script literal, or variable

Return Codes

12204 - The task (RunID) cannot be deactivated. You cannot deactivate objects of a workflow.
12205 - The task RunID) cannot be deactivated because some of its subtasks are still active.
12206 - The status definition is not numerical.
12207 - The status definition is not in an ascending order (from-to).
12208 - The status definition is syntactically incorrect.
12209 - Cannot find the status definition: The object has not been deactivated automatically.
12210 - The status definition is not numerical. The object has not been deactivated automatically.

Comments

You can only deactivate tasks that have already ended (either they have been successfully completed or were canceled). When tasks are deactivated, they are also removed from the activities (Activity Window). Note that you must indicate the task's RunID for this purpose.

The following rules apply for the deactivation process:

In executable objects, you can also define settings for their automatic deactivation. These settings will also be checked by the system.

Examples

The following example activates an object and waits until it has ended. A message will be sent to the responsible user if an error occurs. When the object ends without an error, it will be deactivated.

:SET &ACTOBJ# = ACTIVATE_UC_OBJECT(&OBJ#,WAIT)

:
IF &ACTOBJ# = "0"
:   
SET &ERRNR# = SYS_LAST_ERR_NR()
:   
SET &ERRINS#  = SYS_LAST_ERR_INS()
:   
SET &MESSAGE# = GET_MSG_TXT(&ERRNR#,&ERRINS#)
:   
SET &RET# = SEND_MAIL("John.Smith@automic.com",,&MESSAGE#, "Please check. Thanks!")
:ELSE
: SET &DEACTJOB# = DEACTIVATE_UC_OBJECT(&ACTJOB#)
:
ENDIF

 

See also:

Script Elements Description
ACTIVATE_UC_OBJECT Activates an object.
RESTART_UC_OBJECT Repeats the execution of a task.