Announcements
No record found.
Hi
I have a requirement to show only last 5 cases on the contact form. Any advise would be great. Thanks
*This post is locked for comments
Hi Chaitanya,
The following would be the simplest implementation:
1. You will need to create a view on the Case entity to show the Case records with the appropriate columns and in the correct order.
2. You will then need to place your subgrid on the Contact form, and in the designer, configure it such that it shows only a maximum of 5 rows. Notice that you'll still have the paging controls at the bottom of the subgrid allowing users to view more records
Alternatively you could write a custom HTML control to display on your Contact form (or an SSRS report to run from your Contact records) and show only the 5 most recent associated Case records.
Create a view with sort order based on createdon date descending order. Set this view as default view on the subgrid with 5 rows. This will show 5 most recent cases always on top and remaining cases will be in next page.
Apologies - I forgot to mention you need to configure your subgrid so it uses the new view you've created.
i am aware of this but i don't want to show more than 5 . Thanks
You could try tapping into the 'RetrieveMultiple' message in a plugin, check that the QuestionExpression object contains the columns you've specified in your view, and then modify the QueryExpression.TopCount property as you need?
Hi,
As Parvez suggests you can register a plugin on retrievemultiple message (pre-operation) and check the query. If it matches to the filter of your view then limit the maximum number of records to be retrieved to five.
guruprasadcrm.blogspot.pt/.../plugin-on-retrieve-multiple-message-in.html
The following plugin (retrivemultiple message and pre-operation) code does that:
if (context.InputParameters.Contains("Query") && context.InputParameters["Query"] is QueryExpression) { // set here the collums of the view to limit the records string[] viewCollums = { "title", "createdon" }; // collumns of the query collumnSet QueryExpression query = context.InputParameters["Query"] as QueryExpression; string[] queryCollumns = query.ColumnSet.Columns.ToArray(); // check if both arrays have the same elemts bool equals = viewCollums.Length == queryCollumns.Length && queryCollumns.All(x => viewCollums.Contains(x)); // sets the number of rows to be returned. if (equals == true) { query.TopCount = 5; } }
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
JS-09031509-0 3
AS-17030037-0 2
Mark Eckert 2