Based on List field, how to add or remove approvers in approvers Related list using bussiness rule??

_Omkar_sai_
Tera Contributor

Hi ,
I'm Omkar, I have a requirement to do dynamically add or remove approvers in approvers related list based on list field using business rule. Could you please suggest me solution for this requirement . I was able to do insertion but unable to do removing the approvers based on that list field dynamically. If I write GlideRecord.deleteRecord()  or GlideRecord.multiple()   (table is sysapproval_approver), it's showing an error like following picture even I had given  delete  operation access to my scoped application for Removing.

PeddintiOmkars_0-1673619086614.png

 

For Example: 
I added Fred Luddy , Abraham Lincoln, Abel Tuter in the list field , then those should be added in approvers related list . If I remove Abel Tuter from the list field ,then he should be removed from the approvers related list. 

 

Please suggest any solution for this or suggest me any approaches for this requirement.

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

I would suggest you don't delete the approvers but instead change its state to 'no longer needed'. That would leave the perfect audit trail as well for record keeping.

-Anurag

View solution in original post

5 REPLIES 5

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

I would suggest you don't delete the approvers but instead change its state to 'no longer needed'. That would leave the perfect audit trail as well for record keeping.

-Anurag

Hi Anurag,

Thank you for the suggestion. I'll apply this in my script.

kmohammed
Kilo Guru

Hi Omkar,

The error message "delete operation from scoped app is refused on table cross scope access policy" suggests that your scoped application does not have the necessary permissions to delete records from the sysapproval_approver table. This is likely because the sysapproval_approver table is a system table and is protected by a cross-scope access policy.

A cross-scope access policy is a security feature that prevents scoped applications from accessing or modifying records in system tables. This is done to ensure that scoped applications cannot inadvertently or maliciously cause system-wide problems by modifying or deleting important data.

To resolve this issue, you will need to request the necessary permissions from your instance administrator. They will have to grant your scoped application the "delete" operation on the sysapproval_approver table.

Alternatively, you can consider using a server-side script (e.g. a Business Rule, Script Include, etc.) that has the necessary permissions to delete records from the sysapproval_approver table. Your client script would then call the server-side script to perform the delete operation.

It's also possible to raise a support case to service now to check if there is any other way to achieve this requirement.

Please let me know if you have any other questions. Mark helpful if this solves your issue.

Hi Mohammed
As you suggested , I had tried with business rule or script include to remove the record . But, it didn't worked. Could you please share the script that I can understand. 

Thanks.