You need to sign in to do that
Don't have an account?
Adil_SFDC
Help in Formatting List
Hi All
I am trying to get documents from an external website in a list in the descending order of last updated field.
Now the document might have been updated many times since the date it is created. So my list is displaying the documents same number of times, I want it to be displayed only once w.r.t to Id How do I Map it.
pLEASE HELP.
public List<Document> defaultSortdocIds(List<Document> OdocList ){ List<String> docId = new List<String>(); List<String> finaldocId = new List<String>(); List<Document> tempdoc = new List<Document>(); for(Document d : OdocList){ docId.add(d.lastupdated); } docId.sort(); for(Integer i=docId.size()-1;i>=0;i--){ finaldocId.add(docId.get(i)); } for(String s : finaldocId){ for(Document d : OdocList){ if(d.lastupdated==s){ tempdoc.add(d); } } } return tempdoc; }
.Thanks in Advance
What field type is lastUpdated? There's no such field on Document.
Also, you're having a list of string and then sorting them, it won't sort it by date anyway.
Try this, it's a similar code (only difference is I have written it for sorting Accounts in descending order of their Last Modified Date)
Hi Vishal
This is not Salesforce field or object and my lastupdate value is a string . These values are coming from an external website through integration
Here is what i tried and i get error TOO MANY SCRIPTS