DEACTIVATE_UC_OBJECT
Use the DEACTIVATE_UC_OBJECT script function to deactivate a completed task. The function lets you deactivate tasks that have already ended:
- Tasks that completed successfully
- Tasks that were canceled
Important!
- You cannot deactivate Workflows that include active tasks (for example, a job within the Workflow is still running) or deactivate child Workflows that include active tasks.
- To deactivate tasks that have been started by a Workflow, you must deactivate the top Workflow and ensure that none of the child tasks are active.
- When you deactivate tasks, they are removed from the Process Monitoring perspective.
Tip: You can define settings in executable objects to automatically deactivate the task. 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 Code | Description |
|---|---|
| 12204 | Task cannot be deactivated because you cannot deactivate objects of a Workflow. |
| 12205 | Task cannot be deactivated because the task has active child tasks. |
| 12206 | Status definition is not numerical. |
| 12207 | Status definition is not in an ascending order (from-to). |
| 12208 | Status definition is syntactically incorrect. |
| 12209 | Cannot find the status definition, so the object has not been deactivated automatically. |
| 12210 | Status definition is not numerical, so 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 an error, the script deactivates the task.
: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