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
Notes:
- You cannot deactivate Workflows that include active tasks, 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
-
DEACTIVATE_UC_OBJECT
Deactivates a completed task -
RunID
RunID of the task to deactivate
Format: 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 in the child tasks
Format: AE name, script literal or script variable
Notes:- The system does not check whether the task that you are deactivating is running in a Workflow.
- The system does not check whether child tasks in the Workflow are active.
Return Codes
The script function returns the following codes:
- 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
Example
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: