The approval field and why it works the way it does
Enable AI Animation
- There’s the told approval engine that I believe evaluates the
sysrule_approvalsandprocess_guiderecords. There’s a number of approval rules againstsc_request
Depending on how theapproval_engines.dopage is configured controls how the legacy approvals work. Lets look at the three tables in question;- Catalog Task is set to use Process Guides
- Requested Item using approval engine when it’s associated to a delivery plan, otherwise it’s handled in the workflow or flow.
- Request is managed by workflows only.
- Catalog Task Process Guide
- Catalog Task Default ( when this condition is true
state=1^delivery_task.sys_class_name=cat_item_dt_approval)
Those invoke a call to this script includeGlideappTaskApprovalHelperwhich is hidden/unavailable but is setting the approval torequestedwhen there are no approvers.
- Catalog Task Default ( when this condition is true
- Catalog Task Business Rules
- Auto Close on Approval - This is used on Execution Plan tasks and sets the
activeandwork_endfields. - Reject Parent - This is used on Execution Plan tasks and sets the
sc_req_item.approvalbased on thesc_taskif it’s rejected.
- Auto Close on Approval - This is used on Execution Plan tasks and sets the
- Task Business Rules
- Stamp Approvals - This sets
approval_setto the current time when approved or rejected, otherwise it clears the value. - Moot Approvals Upon Cancellation - This looks at all individual and group approvals for the current task, if the state of the
sysapproval_approverorsysapproveral_grouparerequestedornot requestedthis sets’ the approval record tonot_required. - task events - This generates events that notifications and script actions can trigger against.
task.approved- no script actions against thistask.rejected- no script actions against this
- Stamp Approvals - This sets
- Requested Items Approval Engines - There are none.
- Requested Items Workflows (KB0538552)
Approval Action- Sets the approval as configured.Approval - User- Sets approval to Requested, and then Approved or Rejected as configured.Approval - Group- Sets approval to Requested, and then Approved or Rejected as configured.Rollback To- Sets approval to Not Yet Requested or Requested as configured.
- Requested Items Flows
Ask for Approval- Sets the approval to Requested, and then Approved or Rejected as configured.
- Requested Items Business Rules
- Items Added After Request Approved - runs before insert, where
current.request.approval == approved and current.stage == waiting_for_approval
Then if the catalog item associated uses workflow or flow, set thecurrent.approval = requested
Else,current.approval = current.request.approval - Set RITM Due Date On Insert - calculates the
due_date - request item closure - cancels related approvals when the item becomes cancelled
- sc_ic: Copy Approval Definitions - This calls
sc_ic_Factorywhich deals with the catalog item designer. - reject approval on closed incomplete - runs before insert or update where
current.state.changesTo(4)
Then it sets the approval to rejected.
- Items Added After Request Approved - runs before insert, where
- Request Workflows
- CUSTOMDelta_HC_Request Level Approval active == true (
parent.ref_sc_req_item.cat_item.category=<hardware/software procurement>^EQ) Looks for a variable ofRequested_Forto find the manager. Then asks for anAproval - Useror ends. - CUSTOMDelta Service Catalog Request active == true (
no condition) set’sapprovaltorequestedthen Marks task approved - Source Request active == false (
sourceable=true^approval=approved^EQ) - Service Catalog Request active == false (
no condition) - Delta Hardware Catalog Generic active == false (
parent.ref_sc_req_item.cat_item.category!=<hardware/software procurement^EQ)
- CUSTOMDelta_HC_Request Level Approval active == true (
- Request Business Rules
- request closure - this appears to cancel related approvals by calling
SNC.Requestbut that code is not accessible. - Set Request State - this sets the
sc_request.stageandsc_request.state. - Cascade Request Approval to Request Item - runs after insert or update where current.approval.changes()
if the item is a sequenced request item, sets the stage to not started
else cascade the approval to the request item, which works differently for workflow, flow and delivery plan
workflow if current.hasWorkflow, if (stage iswaiting_for_approvalor is sequenced item) and request.approval == approved, current.approval =requested, elserejected
flow if current.hasFlowDesigner, if (stage iswaiting_for_approvalor is sequenced item) and request.approval == approved, current.approval =requested, elserejected
delivery plan copies the approval from the request.approval - sc request events - triggers events - look for script actions
- sc_request.approved - no script action
- other events not applicable
- request closure - this appears to cancel related approvals by calling