Business Rule to update change/approval/group approval

Matt B4
Tera Contributor

Our sysapproval_approver table has a custom field called Role (u_role) which is populated based on an evaluation of the approver, fields on the change request, and the assignment group of a group approval.

The main issue I'm having is when to set the business rule to run, and on which table. The one I'm having an issue with is running on the sysapproval_group table. When the group approval is inserted, it needs to query the change record and the group approval in order to populate the u_role field on the sysapproval_approver table. I'm unclear on the relationship between the individual and group approval and what order those records get submitted in. My current rule is set to run after insert/update, but the values are not being updated. Any insight is appreciated, and I can provide more information on request. Thank you!

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Group Approval record would come first. I would suggest running this before insert/update of the sysapproval_approver record. You can then dot walk to the group (group) and the change (sysapproval).

View solution in original post

5 REPLIES 5

Community Alums
Not applicable

Group Approval record would come first. I would suggest running this before insert/update of the sysapproval_approver record. You can then dot walk to the group (group) and the change (sysapproval).

That did it. I really appreciate your help!

Matt B4
Tera Contributor

Thank you Mark, I will give that a try. Appreciate your time!

asifnoor
Kilo Patron

Hi,

Create a before insert Business rule on sysapproval_approver table

Filter conditions:

approval for.number stars with CHG

Then in script

//to access change requst fields 
var number = current.sysapproval.number; //you can do the dot walk and can evaluate
var group = current.group.assignment_group; //this gives you group approval assignment group
var approver = current.approver; //returns the approver
//you can do the comparisons and then to update role field
if(condition) {
  current.u_role=""; //mention the role
}

Mark the comment as a correct answer and also helpful if this has helped you to solve the problem.