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

how to sort a list of s object names or strings in a particular order
Hi,
I need a solution for below requirement, i tried but i am not getting proper result. Please help me on this.
1. if list returns == account, case, opportunity, contracts, idea, product, order, solution, campaign
order should be account, case, opportunity, remaining all are in alphabetical order.
2. if list returns == account, opportunity, contracts, idea, product, order, solution, campaign
order should be account, opportunity, remaining all are in alphabetical order.
3. if list returns == case, opportunity, contracts, idea, product, order, solution, campaign
order should be case, opportunity, remaining all are in alphabetical order.
4. if list returns == account, case, contracts, idea, product, order, solution, campaign
order should be account, case, remaining all are in alphabetical order.
5. etc
how we achieve this
I need a solution for below requirement, i tried but i am not getting proper result. Please help me on this.
1. if list returns == account, case, opportunity, contracts, idea, product, order, solution, campaign
order should be account, case, opportunity, remaining all are in alphabetical order.
2. if list returns == account, opportunity, contracts, idea, product, order, solution, campaign
order should be account, opportunity, remaining all are in alphabetical order.
3. if list returns == case, opportunity, contracts, idea, product, order, solution, campaign
order should be case, opportunity, remaining all are in alphabetical order.
4. if list returns == account, case, contracts, idea, product, order, solution, campaign
order should be account, case, remaining all are in alphabetical order.
5. etc
how we achieve this
Hi Ram,
Shubham Nandwana.You can write the query with objects in the order you want to get the desired results.
AppPerfect Corp.
salesforce@appperfect.com
408-252-4100
http://www.appperfect.com/services/salesforce/
Salesforce Development & Operations Experts
For this kind of scenario, there is no direct solution.
We can achive this through via Custom Label/Custom setting:
Step 1: If custom label (LabelName: ObjectNamePrioritise), Keep your Prioritise value here like: Value-> account,case,opportunity .....
String allObjectName = Label.ObjectNamePrioritise;
Step 2: Assuming your all list like
List<String> allObjectName = new List<String>{'account', 'case', 'opportunity', 'contracts', 'idea', 'product', 'order', 'solution', 'campaign'};
Step 3: Get Final OK list: finalOKlist
Try this code: Mark your answer if it works
Thanks
Niraj