DEACTIVATE_UC_OBJECT

Use the DEACTIVATE_UC_OBJECT script function to deactivate a completed task. Deactivated tasks are removed from the Process Monitoring perspective. You can deactivate tasks that completed successfully and tasks that were canceled.

Important! You cannot deactivate Workflows that contain active tasks (for example, a Job within the Workflow that is still running), or deactivate child Workflows that contain active tasks. To deactivate tasks started by a Workflow, you must deactivate the top-level Workflow and ensure that none of its child tasks are active.

Tip: You can configure executable objects to deactivate tasks automatically. For more information, see Automatic Deactivation Section.

Syntax

DEACTIVATE_UC_OBJECT (RunID [,FORCED])

Parameters

Parameter Description Format
RunID RunID of the task to deactivate Script literal, script variable, or number without quotation marks
FORCED
(Optional, Workflows only)
Deactivates the Workflow task and all child tasks regardless of their status and any automatic deactivation settings. Active items are removed from the Workflow monitor (EJPP) but not from the Process Monitoring view (EH).
Important! The system does not check whether the task being deactivated is running in a Workflow, or whether child tasks in the Workflow are active.

When a Workflow is canceled while a job inside it is still processing its Post Process page, a forced deactivation moves the current status from the EJPP table to the AJPP table and deletes it. After post-processing completes, the job finishes and is deactivated from the EH table. Because the AJPP table receives no further updates after the Workflow is deactivated, the Workflow Monitor may still show that job as running. You can avoid this by not applying forced deactivation during post-processing, or by accepting this display behavior. For details on database tables, see Database Areas.
AE name, script literal, or script variable

Return Codes

Return Value Condition
12204 Task cannot be deactivated because you cannot deactivate objects of a Workflow
12205 Task cannot be deactivated because it has active child tasks
12206 Status definition is not numerical
12207 Status definition is not in ascending order (from–to)
12208 Status definition is syntactically incorrect
12209 Status definition not found; the object has not been deactivated automatically
12210 Status definition is not numerical; the object has not been deactivated automatically

Examples

The following example activates an object and waits for the task to complete. If an error occurs, the system sends an email to a user. If the task completes without error, the script deactivates it.

: 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: