I would like to sort opportunities appearing in the My Opportunities dashlet by closeDate. I modified /application/Espo/Modules/Crm/Resources/metadata/dashlets/Opportunities.json by changing the default sort from "sortBy": "createdAt" to "sortBy": "closeDate", which works, except it sorts by close date in reverse chronological order (most distant close date is listed first). I would like to reverse this sort order. What file do I need to modify? Thanks.
How to sort Opportunities Dashlet by "closeDate"
Collapse
X
-
No need to modify another file, but change the "asc": false to "asc": true
Also you should move this file to the custom/Espo/custom/Resources/metadata/dashlets folder otherwise it might be overwritten during an upgrade. -
Yep.
Better to create custom/Espo/custom/Resources/metadata/dashlets/Opportunities.json
PHP Code:{ "options": { "defaults": { "sortBy": "closeDate", "asc": false } } }
Last edited by yuri; 04-13-2016, 06:55 AM.If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.Comment
-
Thanks to both of you for your help. In addition to the change from "createdAt" to "closeDate", I had already made some changes to the "expandedLayout" section of the file, so I moved the entire, modified file to the custom/Espo/Custom/Resources/metadata/dashlets directory. I had to first create the custom /dashlets directory, because it didn't exist. After that, I copied a backup I had made of the original, unmodified Opportunities.json file to the /application/Espo/Modules/Crm/Resources/metadata/dashlets directory. It works as intended. One question: would it be better to include only the modifications in the custom file, instead of reproducing the entire, modified file within the custom/Espo/Custom/Resources/metadata/dashlets directory?
Thanks again for you guidance. Much appreciated!Comment
-
yuri can answer this question better than me, but I think it's better to just copy the things you have modified instead of the whole file because:
1) it's easier to keep track of the changes you have made if you only copy these changes to the new file, and
2) you want for the rest of the file to be updated if necessary. If you copy the whole file, then changes to other sections of these files will not take effect if you copy the whole file to the custom folderLast edited by jcortes0309; 04-14-2016, 05:05 AM.Comment
-
-
I included only the modifications in the custom files. Works perfectly. Thanks.
Is the custom directory only for modifications to .json files located in the /application/Espo/Modules/Crm/Resources/metadata directory/subdirectories? Or, can you set up custom file modifications for other types of files, such as /application/Espo/Modules/Crm/Services/Opportunity.php?Comment
Comment