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

vf remoting
Create a new link on the contact row to delete the contact from the account. On clicking the link, the contact should be deleted this time using VisualForce Remoting. On successful deletion, an alert should be displayed on the page stating “The contact has been deleted”.
You need to create an Apex class and add this method:
@RemoteAction
global static Boolean updateContact(String conId) {
try{
contact con = new contact(AccountID = null, ID = conId);
update con;
return true;
}
catch(Exception){
return false;
}
}
You can call this method using "Visualforce.remoting.Manager.invokeAction" and pass the contact ID to remove the accountId, and you will get result true if successfully deleted or false in case of any issue.
Here is the link for example of VF Remoting: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_js_remoting_example.htm
Thanks,
Nitin
All Answers
Contact.AccountId = null;
Update contact;
and use https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_js_remoting_example.htm
for remoting.
You need to create an Apex class and add this method:
@RemoteAction
global static Boolean updateContact(String conId) {
try{
contact con = new contact(AccountID = null, ID = conId);
update con;
return true;
}
catch(Exception){
return false;
}
}
You can call this method using "Visualforce.remoting.Manager.invokeAction" and pass the contact ID to remove the accountId, and you will get result true if successfully deleted or false in case of any issue.
Here is the link for example of VF Remoting: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_js_remoting_example.htm
Thanks,
Nitin