Can someone point me to a code sample that does the following:
I want to update a custom field on all the account related contact records called relationship__c from a button on the parent account record.
I do not care if the button is a detail or list button. All it needs to do is get the account ID, search for all the child contact records and update that field to say relationship__C = "New". That's it but for someone who is not familiar with javascript, I'm hitting a wall. (I can update the account record but can't seem to get the contacts.) If anyone can help with a code example, I'd appreciate it.
Best Answer
You can invoke an apex class using the AJAX Toolkit. Here is one small example.
Create a custom button on Account and select JavaScript Execute onclick:
Create an Apex webservive class and write your logic. Here is the code:
Add your button from page layouts...
Cheers Vineeth