Using RPA.Robocorp.Process library to trigger process via API

rpaframework has a supporting library RPA.Robocorp.Process for Control Room Process API. It can be used to trigger a process (and do also some other things).

API key needs to have permission to trigger process and to monitor run status (preferably all permissions related to Process).

In this example I am triggering a process and then monitoring the run status until state will reach COMPL (run complete).

*** Settings ***
Library   RPA.Robocorp.Process 
Library   RPA.Robocorp.Vault

*** Variables ***
${WORKSPACE_ID}    MY-WORKSPACE-ID
${PROCESS_ID}     MY-PROCESS-ID

*** Tasks ***
Minimal task
    ${secret}=   Get Secret   apikey
    Set Credentials    ${WORKSPACE_ID}    ${PROCESS_ID}    ${secret}[apikey]
    ${run}=    Start Process
    Log to Console    \nstarted run ${run}
    FOR    ${_}    IN RANGE    60
        ${runstatus}=    Get Process Run Status    ${run}[id]
        Log To Console    state: ${runstatus}[state]
        Exit For Loop If    "${runstatus}[state]" == "COMPL"
        Sleep    2s
    END
    Log    Done.

See more information about the library at RPA.Robocorp.Process library

3 Likes