• balakrishna.sfdc1.3966051675866772E12
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello All,

I have one sample list to retreive contact information and data is below.
list<contact> lstcont = [select id,name,accountid,sequence__c from contact where accountid=:accids ];

sample data when I execute the list from developer console:

Contact{Name=a01i000000D6EeW, Account__c=acc1, Id=a01i000000D6EeWAAV, Sequence_Number__c=1},
Contact{Name=a01i000000D6EeX, Account__c=acc2, Id=a01i000000D6EeXAAV, Sequence_Number__c=1},
Contact:{Name=testaccount, Account__c=acc1, Id=a01i000000D6EeaAAF, Sequence_Number__c=2})

I want to modify the list order by Account wise, for example

Contact{Name=a01i000000D6EeW, Account__c=acc1, Id=a01i000000D6EeWAAV, Sequence_Number__c=1},
Contact{Name=a01i000000D6EeX, Account__c=acc1, Id=a01i000000D6EeXAAV, Sequence_Number__c=2},
Contact:{Name=testaccount, Account__c=acc2, Id=a01i000000D6EeaAAF, Sequence_Number__c=1})

Please share the ideas how to change the list order as required.

Thanks,
Krishna
Hello All,

I have one sample list to retreive contact information and data is below.
list<contact> lstcont = [select id,name,accountid,sequence__c from contact where accountid=:accids ];

sample data when I execute the list from developer console:

Contact{Name=a01i000000D6EeW, Account__c=acc1, Id=a01i000000D6EeWAAV, Sequence_Number__c=1},
Contact{Name=a01i000000D6EeX, Account__c=acc2, Id=a01i000000D6EeXAAV, Sequence_Number__c=1},
Contact:{Name=testaccount, Account__c=acc1, Id=a01i000000D6EeaAAF, Sequence_Number__c=2})

I want to modify the list order by Account wise, for example

Contact{Name=a01i000000D6EeW, Account__c=acc1, Id=a01i000000D6EeWAAV, Sequence_Number__c=1},
Contact{Name=a01i000000D6EeX, Account__c=acc1, Id=a01i000000D6EeXAAV, Sequence_Number__c=2},
Contact:{Name=testaccount, Account__c=acc2, Id=a01i000000D6EeaAAF, Sequence_Number__c=1})

Please share the ideas how to change the list order as required.

Thanks,
Krishna