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
tbuckettbucket 

Gantt Chart Sort Order

What's the easiest (or best) way to change the order of Milestones or Tasks displayed in the Gantt?  I can live with an alphabetical order for a little while, but when I have 20 or so Milestones, then I need to add one at line 12 (for example), it can become a bear to edit all Milestones after that one. just to make it sort properly.

 

I'm sure someone has already tackled this one...just wondering the best way to do it.  

 

 

Best Answer chosen by Admin (Salesforce Developers) 
ReidCReidC

Probably worth adding this as an issue over on github.

https://github.com/ForceDotComLabs/Milestones-PM/issues/43

 

If you go into the chart controller, you should be able to chance the order by clause on a SOQL statement and have it work.

I think it's this class

https://github.com/ForceDotComLabs/Milestones-PM/blob/master/src/classes/Milestone1_Charts_GanttController.cls

 

soql is on line 119.

All Answers

ReidCReidC

Probably worth adding this as an issue over on github.

https://github.com/ForceDotComLabs/Milestones-PM/issues/43

 

If you go into the chart controller, you should be able to chance the order by clause on a SOQL statement and have it work.

I think it's this class

https://github.com/ForceDotComLabs/Milestones-PM/blob/master/src/classes/Milestone1_Charts_GanttController.cls

 

soql is on line 119.

This was selected as the best answer
Daniel Barckley 7Daniel Barckley 7
I know this is crazy old but I just wanted to put this here because the best way to organize that Gantt is by Date. I spent a day figuring it out and wanted to put my results somewhere.
Milestones PM has two Start Date fields Kickoff__c and Start_Date__c so you can't just input those following "order by" you actually need to use their startDateFieldName. The code will then sort by Start Date regardless of the field name and it will looks like this (starting at line 119):

String query = 'Select '+idFieldName+','+startDateFieldName+','+endDateFieldName+','+nameFieldName+','+completedFieldName+
                       ' from '+objectType+ ' where '+filterFieldName+'=\''+mytarget+'\' order by '+startDateFieldName+'';

Hope that saves some time for y'all.