Skip to main content

Does anybody have a method for telling if an authorization task was flagged as not authorized so that we can generate the following tasks dynamically? 

Currently, we use a decision task following the authorization that uses the function below (called in AP) to evaluate the answer and take a decision. However, this doesn’t work in workflows that have multiple authorizations occurring at the same time since it evaluates whether any “Not Authorized” was taken.

function evalAuthTasks(parmEventId)

    --LOGGER:info("First line in evalAuthTasks")
    local sSql =  SELECT COUNT(id.u_num2) NOTAUTH_COUNT
        FROM act_reg ar
        INNER join act_type at on at.act_type_id = ar.act_type_id
        INNER join inc_data id on id.incident_id = ar.incident_id
        INNER join incident i on i.incident_id = ar.incident_id
        INNER join incident i2 on i2.incident_id = id.u_num2
        WHERE id.u_num2 = (select u_num2 from inc_data WHERE incident_id = ]] .. parmEventId .. 
        HE)    and at.act_type_sc = 'NOT AUTHORIZED' ]] 
   
    local result,err = DB:sql(sSql)
    if err then 
        LOGGER:error("Error in SQL when checking for Authorization Tasks Answer. Error: " .. (err or "??") .. "\nSQL: " .. stringify(sSql))
        takeDecision(parmEventId, "Approved")
        return false
    end

    -- LOGGER:info("count = " .. stringify(result 'NOTAUTH_COUNT']))
    if result<'NOTAUTH_COUNT'] > 0 then
        -- LOGGER:info("REJECTED")
        takeDecision(parmEventId, "Rejected")
    else
        -- LOGGER:info("APPROVED")
        takeDecision(parmEventId, "Approved")
    end
    
    -- Returning false because the decision task will auto close after decision is made. 
    return false
end

 

I was able to successfully create an AP rule that uses the ETM to update a field based on the Authorization answer that I can evaluate on tasks but by the time it’s set the task that I want to be dynamic has already been created.

Another option we’ve considered is using a decision task instead of authorization task, however decision tasks do not have dynamic expressions on them, and these tasks should only be generated when specific booleans are set on the parent event.

One workaround might be to have the decision task evaluate the fields in the parent event and put a condition to automate an answer. In this case we would need to evaluate multiple boolean fields and if all returned as “false” then we would set the decision answer to “no”. The decision task would still be generated but they wouldn’t need to take an action on it at least. 

 

I tried something similar to the following in the condition field on a Decision Answer with no success:
if($new.W(“ECOURTTAB”), ​​​​​​​if($new.W(“COURT”), ​​​​​​​if($new.W(“SILS”) = “False”)))

 

Thanks in advance for any suggestions!

Fyi. I figured out how to do the Condition expression for the Decision tasks. I just needed to simplify it a bit and point to the parent event like this:


$new.parentEvent.W("ECOURTTAB") = "false" 
AND $new.parentEvent.W("COURT") = "false" 
AND $new.parentEvent.W("SILS") = "false" 
AND $new.parentEvent.W("DOCSHOP") = "false" 
AND $new.parentEvent.W("JDAWG") = "false" 
AND $new.parentEvent.W("DIVERSION SCREENING") = "false"

Still interested if there is a way to use the authorization tasks more effectively however.
Thanks!


Reply