You need to sign in to do that
Don't have an account?

Deleting Related Record using Apex Controller
Hi Everyone,
This may be my most pathetic post yet, but I can not seem to figure this out. I have used VS pages and Apex Controllers to create new records and update existing--- HOWEVER, deleting just has me stumped!
What i would like to do is...
Create a button called "Delete myself from Account Team" and put it on the Account Object. Upon clicking the button, i would like the system to loop thru all Account Team Members and delete the one that matches the current users's User Id. Does anyone have the code for this?
This may be my most pathetic post yet, but I can not seem to figure this out. I have used VS pages and Apex Controllers to create new records and update existing--- HOWEVER, deleting just has me stumped!
What i would like to do is...
Create a button called "Delete myself from Account Team" and put it on the Account Object. Upon clicking the button, i would like the system to loop thru all Account Team Members and delete the one that matches the current users's User Id. Does anyone have the code for this?
Below code should work for you :
Put this in a method and call that method on your button click.