Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Keep in mind that the Approval Order must be a string, and as such it is recommended to pad single digits with a 0 - to make sure that if there are more than 9 approvers they are sorted correctly. In the unlikely event that there are more than 99 approvers another 0 must be added before the number.

In the Configuration > Workflows > Workflow Formulas Logics create the following workflow formulalogic:

Code Block
languagegroovy
if (quote?.lineItems == null) return

def ppTable = api.findLookupTable("ApprovalFlow")
def approvers = api.find("MLTV", 0, "name", Filter.equal("lookupTable.uniqueName", "ApprovalFlow"))

for (li in quote?.lineItems){
  if (li.folder) continue
  for (e in li?.outputs) 
  {      
      for (approver in approvers) {
          if (approver.attribute1 == "Group" && approver.attribute3 != "Yes") {
          	workflow.addApprovalStep("Approver" + approver).withUserGroupApprover(approver.attribute2).setReason("Requires " + approver.attribute2 + " approval")
        
          }else if (approver.attribute1 == "User" && approver.attribute3 != "Yes") {
          		workflow.addApprovalStep("Approver" + approver).withApprover(approver.attribute2).setReason("Requires " + approver.attribute2 + " approval")
        		}
        }
      break
   }
}

...