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
Bittu Kumar 59Bittu Kumar 59 

i want to create trigger that can handle sequence of contact on account ,

Create custom field on Contact for "Sequence Number". Create trigger to manage sequence of Contacts on an Account. Handle all the events and cases.

# Re-order sequence number when new records are inserted
# Re-order sequence number when records are updated
# Re-order sequence number when records are deleted
# In case of re-parenting, add record at last position
# In case of undelete, add record at last position

- Create test sheet for all the test cases
- Create test methods for all the test cases, please refer acceptance criteria                                                                                                                                                                                                                      1) Bulk Re-parenting
2) Bulk update sequence number
3) Remove Parent
4) Bulk (Create, Update, Delete, Undelete)
5) update legacy (Existing) records

Test class coverage should be above 95%
SwethaSwetha (Salesforce Developers) 
HI Bittu,
Use the code from https://developer.salesforce.com/forums/?id=9062I000000g4YuQAI to get started

If this information helps, please mark the answer as best. Thank you
Andrew Gillan 30Andrew Gillan 30
Reads like a homework question.  I don't do people's homework.  Best you get cracking.