function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
munna123munna123 

how to update the custom field in account object having list of contacts after deletion of one contact

using triggers how to get the list of remaining contacts seperated by "," in custom field created in accountobject related to contact obj 
 
SonamSonam (Salesforce Developers) 
You can do this using a Contact trigger , sample code on the thread 
http://salesforce.stackexchange.com/questions/63282/apex-trigger-on-contact-to-update-field-on-account
Lahiru BandaraLahiru Bandara

Using a SOQL query you can easily grab all remaining list of contacts and display them in a custom field. Also a list can be easlily converted to whatever format you want. So which part you have concerns about?

Thanks,
Lahiru

https://lahirustechtalk.wordpress.com/

munna123munna123
actually i created a custom field "contacts name" in account object. under a particular account if we create contacts they should get displayed in that custom field seperated by ",". similarly if we delete a contact, remaining group of contacts should be displayed under that particular account... i did as below but its not working..... can u correct it plz trigger tgr_updating_contact_2 on Contact (after insert, after update, after delete) { setaccid = new set(); if(trigger.isdelete){ for(contact c:trigger.old){ accid.add(c.accountid); } } else{ for(contact c:trigger.new){ accid.add(c.accountid); } } listaccnt = new list(); accnt = [select id, contacts_name__c,(select firstname, lastname from contacts) from account where id in:accid]; for(account a:accnt){ a.contacts_name__c = null; for(contact c:a.contacts){ if(a.contacts_name__c==null) a.contacts_name__c = c.lastname; else a.contacts_name__c = c.lastname+ ','+ a.contacts_name__c; } for(contact c:a.contacts){ if(Trigger.isDelete && c.AccountId != null){ a.contacts_name__c= a.contacts_name__c; } } } update accnt; }
munna123munna123
hiii sonam, i need to create an app to generate reports on notes and attachments of standard objects or custom objects. requirement is to add object from drop down and then after to select the required fields using checkbox. after that we have to get the details of the notes and attachments of respective selected object... can u guide me how to do this
munna123munna123
hiiii i need to create an app to generate reports on notes and attachments of standard objects or custom objects. requirement is to add object from drop down and then after to select the required fields using checkbox. after that we have to get the details of the notes and attachments of respective selected object..
munna123munna123
hiii , my requirement is when i select the required object fom dropdown and click "add" button, i have to get the list of fields of that particular object with checkboxes. when i checkin some fields like phone, name and all then i need to get all the records of that object with the selected field values. i have a program regarding this. but the thing is its not working for custom objects. it is giving some error... and i want to improve my program so that if i checkin and click " view report" button, i have to get the records of that particular object with selected fields and the list of notes and attachments (if present) for all records of that selected object... here is my code vf page:
munna123munna123
hiii , my requirement is when i select the required object fom dropdown and click "add" button, i have to get the list of fields of that particular object with checkboxes. when i checkin some fields like phone, name and all then i need to get all the records of that object with the selected field values. i have a program regarding this. but the thing is its not working for custom objects. it is giving some error... and i want to improve my program so that if i checkin and click " view report" button, i have to get the records of that particular object with selected fields and the list of notes and attachments (if present) for all records of that selected object... here is my code vf page: