You need to sign in to do that
Don't have an account?
Puja khetan
cancel record which is in approval process
I have custome object on which i wanted to give Cancel functionality to users .plan is to do using flow and apex .
on my custom object there is approval process as well .
my plan is
if record status field value is New then simply i can change status to cancelled .
if record is submitted for approval ,in this case ,i am using lock check box ,which is checking if my recod is locked so in this case i have to call apex class that apex class need to delete this record queue from approval process queue .
as if simply i will change status to cancelled on this case as well then approval will still seeing this record is pending for their approval and they can approve .
so some one can help me apex code ? which simple will delete this record entry from approval queue ?
on my custom object there is approval process as well .
my plan is
if record status field value is New then simply i can change status to cancelled .
if record is submitted for approval ,in this case ,i am using lock check box ,which is checking if my recod is locked so in this case i have to call apex class that apex class need to delete this record queue from approval process queue .
as if simply i will change status to cancelled on this case as well then approval will still seeing this record is pending for their approval and they can approve .
so some one can help me apex code ? which simple will delete this record entry from approval queue ?
Anudeep (Salesforce Developers)
Here is a sample code to delete records from the approval process. Please make changes to your code as per your requirement