Automic Workload Automation

 View Only

  • 1.  REST API - Release job from 'waiting for manual release'

    Posted 27 days ago
    Edited by Michael Ham 24 days ago

    I am working on Automic integration with the REST API.  I've had no success when it comes to releasing a job with status 'waiting for manual release'. A similar method of working with a blocked job can easily be unblocked via the API.

    I see a less ideal method, modify_status is able to change from the status 1693 'waiting for manual release' to another number. 

    Question1: is there a method to change a job status from 'waiting for manual release' via the REST API?
    Question2: is there a status code change that can do the above function?

    Use case: Service-Now catalog task is submitted for a workflow that is currently held. Once approved we would like Service-Now to release the workflow.

    Automic v24.4.1

    https://engineserver:8088/ae/api/v1/ClientID/executions/RunID/unblock_workflow

    -------------------

    https://engineserver:8088/ae/api/v1/ClientID/executions/RunID/modify_status
    {
      "old_status": 1693,
      "new_status": ####
    }



    -------------------------------------------



  • 2.  RE: REST API - Release job from 'waiting for manual release'

    Posted 24 days ago

    Question: Do you have an example of using a SCRI object to change the running status of workflow?

    Update: I'm searching for an Automic script method to release a workflow from held for manual release status.

    REST API - no method is possible. This is a known limitation. Recommendations suggest using a SCRI object with a state change.  I've found 4 methods that in general sound like they would, but none do.

    MODIFY_STATE "Script Statement: Modifies the return code or status text of a job when it has finished"
    TOGGLE_OBJECT_STATUS acts like it does the task but nothing is updated in the held workflow. TOGGLE has only two state changes GO and STOP 
    MODIFY_TASK change internal details about a job/workflow.  No state changes possible.
    ACTIVATE_UC_OBJECT Start/execute an object. Does not modify an existing execution.

    My script object

    :PRINT "===START=="
    :PRINT &RUNID#

    :IF &RUNID# = ""
    :  PRINT "ERROR: RunID not provided."
    :  EXIT 12
    :ENDIF

    :PRINT "Processing RunID: &RUNID#"

    ! Get current status
    :SET &STATUS# = GET_UC_OBJECT_STATUS(&RUNID#)
    :PRINT "Current status: &STATUS#"

    ! 1693 = Waiting for manual release
    :IF &STATUS# <> 1693
    :  PRINT "INFO: RunID is not in 'Waiting for manual release'. No action taken."
    :  EXIT 0
    :ENDIF

    ! Attempt release
    :SET &RET# = TOGGLE_OBJECT_STATUS(&RUNID#,"GO")

    :IF &RET# = 0
    :  PRINT "SUCCESS: &RET#"
    :ELSE
    :  PRINT "ERROR: failed. RC=&RET#"
    :  EXIT 12
    :ENDIF

    -------------------------------------------



  • 3.  RE: REST API - Release job from 'waiting for manual release'

    Posted 19 days ago

    I have not found a documented way to programmatically release a job held for manual release. If the workflow is in a blocked state, there are several options for moving it along.  But nothing for held workflows.

    MODIFY_UC_OBJECT I evaluated the GOIMM and RELEASE operations. They only work on blocked, not held.

    -------------------------------------------



  • 4.  RE: REST API - Release job from 'waiting for manual release'
    Best Answer

    Posted 11 days ago

    Only way to "Release job from 'waiting for manual release' via API or Automic script is to 
    1) change the job to be blocked, not waiting for manual release like normally doing with a precondition.

    2) Automic Script, receive the workflow run ID and job name. execute -

    :SET &RELEASEBLOCK# = MODIFY_UC_OBJECT(&RUNID#, GOIMM, &JOBNAME#)

    3) API execute script POST to /{client_id}/executions

    Content:

    {
      "object_name": "UNBLOCK_WORKFLOW_SCRIPT",
      "execution_option": "execute",
      "inputs": {
        "RUNID#": "12345678",
        "JOBNAME#": "JOBS.API_TESTING"
      }
    }


    ###################

    This is the result of trying to use the intuitive command UNBLOCK_WORKFLOW

    POST to /{client_id}/executions/{run_id}/unblock_workflow
    RESPONSE
    {
        "code": 4001782,
        "error": "Found no blocking tasks. Manually set breakpoints were not considered.",
        "details": "No detail information available."
    }

    -------------------------------------------