How to add/remove approvers using approver user activity in the workflow?

Utkarsha
Tera Contributor

Hi All,

I have a requirement to add/remove approvals for the users added in the approver field , the ask is if i am removing or adding the approver from the field, then approval should be removed or gets inserted into the sys_approval.approver table for that particular record, basically if there is a change in approver field, that should reflect on associated approval records

Could anyone please suggest me anything on this?

Any sort of help is highly appreciated !

I am using below script -

Approver user activity-

var arr = [];
var mi = current.u_approval.split(',');

for (var i = 0; i < mi.length; i++) {
var app = new GlideRecord("sysapproval_approver");
app.addQuery('document_id', current.sys_id);
app.addQuery("approver", mi[i]);
app.addQuery("state", "approved");
app.query();
if (!app.next()) {

arr.push(mi[i]);

}
}
var answer = arr.toString();

 

2 ACCEPTED SOLUTIONS

AnveshKumar M
Tera Sage
Tera Sage

Hi @Utkarsha  

 

Once the WorkFlow created the approval, it can not go back and re do that.

 

The other way out is, write a BR on the table with condition like Approver Changes and in the BR Script,

 

You can query the approval table if you have any active approval requests for that record, if yes you can just update the record with the new approver.

 

Please mark my answer helpful and accept as a solution if it helped 👍

Thanks,
Anvesh

View solution in original post

Tai Vu
Kilo Patron
Kilo Patron

Hi @Utkarsha  

In the Remove case, what you can do is that you can update the State of the Approval record as No Longer Required.

For the Add case, we can do update the Approver field in the Approval record. However, there might be some concerns about the Workflow continuing to the next steps smoothly, especially with the Flow. You need to ensure that the workflow/flow logic can handle changes in the Approver field without causing disruptions.

 

Cheers,

Tai Vu

View solution in original post

2 REPLIES 2

AnveshKumar M
Tera Sage
Tera Sage

Hi @Utkarsha  

 

Once the WorkFlow created the approval, it can not go back and re do that.

 

The other way out is, write a BR on the table with condition like Approver Changes and in the BR Script,

 

You can query the approval table if you have any active approval requests for that record, if yes you can just update the record with the new approver.

 

Please mark my answer helpful and accept as a solution if it helped 👍

Thanks,
Anvesh

Tai Vu
Kilo Patron
Kilo Patron

Hi @Utkarsha  

In the Remove case, what you can do is that you can update the State of the Approval record as No Longer Required.

For the Add case, we can do update the Approver field in the Approval record. However, there might be some concerns about the Workflow continuing to the next steps smoothly, especially with the Flow. You need to ensure that the workflow/flow logic can handle changes in the Approver field without causing disruptions.

 

Cheers,

Tai Vu