
11-11-2011 04:03 AM
Hi All,
I'm trying to sort the Account Opportunities tab by Actual Close Date which I have added within the layout.
I thought I would be able to update this within the form/grid/column properties but that does not appear to be the case from my testing.
Will this require a code update to the AccountOpportunties for me to achieve this?
Any help would be greatly appreciated!
Solved! Go to Solution.
11-11-2011 07:13 PM
Add a C# snippet load action to the form.
grdOpportunities.Sort("ActualClose", SortDirection.Descending);
11-13-2011 02:47 AM - last edited on 11-13-2011 02:47 AM
Many thanks Collin!
11-22-2011 05:04 AM
Hi Collin,
I added the line of code to the Load Actions - Code Snippet Action Item on the AccountOpportunities form as attached but when I go to build the web platform is fails with the below errors. Have I missed something out here? Any help would be appreciated.
ERROR -C:\Users\Administrator\AppData\Roaming\Sage\Platfo
ERROR - C:\Users\Administrator\AppData\Roaming\Sage\Platfo
11-22-2011 05:23 AM
Just to add to my previous post. If I use the C# Snippet Action Item (Obsolete) It builds with no errors and works fine. ![]()
11-22-2011 06:04 AM - last edited on 11-22-2011 06:12 AM
The C# Snippet Action Item (Obsolete) is not obsolete. It will be renamed in Sawgrass.
However, for a Code Snippet Action Item you need to use the following in the load action:
System.Web.UI.WebControls.GridView grid = (System.Web.UI.WebControls.GridView)form.grdOpport
11-22-2011 06:07 AM
Thats great! Many thanks Collin.
01-25-2012 07:57 AM
Good stuff, thanks guys. Now how do you sort on TWO or more columns......specifically
grdAccountContacts....Status , LastName
does the sort field need to be in the grid itself, or is it always a property of the entity itself?
Thanks!
01-25-2012 09:50 AM - last edited on 01-25-2012 09:54 AM
The sort is based on the Entity properties.
Use a HQL Data Source. Select all the properties that you want to sort by even if you aren't going to display them in the grid. Also include the entity ids if you plan to link to them from the grid.
01-25-2012 01:20 PM
I will try HQL, thanks for the tip!