back to top

Setting the Default Sort Column and Direction for a Detail in Creatio (formerly bpm’online)

There are a few different options for setting a sort for details in Creatio. You can add a default sort column and direction to a detail added to a page schema,  or you can add the sort in the detail schema so the sort will apply to the detail no matter where it is used. Let’s take a look at both options.

Adding the Sort to the Detail

If you want to always ensure the detail has your sort column and direction, no matter where you use the detail, the best route is to add it in the detail schema. Then, no matter what page you add the detail on, the sort is built into the detail schema itself and will apply anywhere. To do this, we’ll open the detail schema code in the configuration, then override the onGridDataColumns function by adding the following to the methods:

addGridDataColumns: function(esq) {
    this.callParent(arguments);
 
    // add the column we want to sort by to the EntitySchemaQuery passed in
    // We can use any column, whether or not it is in the column layout for the detail
    // in this sample we'll be sorting on the CreatedOn column in descending order
    var createOnCol = esq.addColumn("CreatedOn");
    createOnCol.orderPosition = 0;
    createOnCol.orderDirection = Terrasoft.OrderDirection.DESC;
}

 

Adding the Sort to the Page the Detail is On

If the detail is on a page and you want to add a sort to it, you can do it in the details page of the page code. This method is useful if you don’t need or want to override the detail schema, for cases when the detail itself is in another package. To do this, open the page code and locate the details section. You’ll see the detail there as follows (this is what is added by the page wizard when you add a detail normally):

details: /**SCHEMA_DETAILS**/{
    "UsrMyDetail": {
        "schemaName": "UsyMyObject",
        "filter": {
            "masterColumn": "Id",
            "UsrAccount"
        }
    }
}

Add the sort column and direction as shown below (again, in our sample we’ll be sorting on the CreatedOn column in descending order):

details: /**SCHEMA_DETAILS**/{
    "UsrMyDetail": {
        "schemaName": "UsyMyObject",
        "filter": {
            "masterColumn": "Id",
            "UsrAccount"
        },
        "sortColumn": "CreatedOn",
        "sortColumnDirection": Terrasoft.OrderDirection.DESC,
        "sortColumnIndex": 0
    }
}

Either method should give you the results you’re after, however, also keep in mind that the user can click on column headers to sort the detail as well. The user’s specified sort will take precedence over what you specify in the code.

Contact Customer FX for your CRM project
We let our expertise speak for itself - let us know how our all-star team can help on your CRM project
About the Author
Ryan Farley
Ryan Farleyhttps://customerfx.com/article/author/ryanfarley/
Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

4 COMMENTS

  1. Hi, Ryan, Is there is a method to sort detail(List in ExpansionPanel) by column in FreedomUI Form page?(ExpansionPanel from another package)
    Thanks you for your responses!

  2. Is it possible to sort a detail using this method based on a value in a related table?

    E.g. Leads sorted by Contact.CreatedOn?

LEAVE A REPLY

Please enter your comment!
Please enter your name here

AI Readiness Checklist for CRM Teams: Is Your CRM System Ready for AI?

Before using AI in Creatio, make sure your CRM data, users, processes, and automation foundation are ready. Use this practical AI readiness checklist for CRM teams.

Build Your Creatio AI Skills with the 2026 AI Summer Program

Join Creatio’s free 2026 AI Summer Program to learn how to identify, build, deploy, and manage AI agents.

Creatio 10x Is Coming: Join the Webinar to Explore the Future of AI-Native CRM

Learn what's new in Creatio 10x and how AI-native CRM, agentic AI, and no-code automation are shaping the future of customer relationship management. Join the upcoming webinar and discover what's next.

Creatio Unlimited Pricing Explained: AI Packages, Costs, Pros & Cons

Learn what Creatio’s new Unlimited pricing model includes, what it doesn’t include, how AI Action packages work, and the pros and cons for businesses evaluating Creatio.

Using the AI Prompt to Create Dynamic Folders in Creatio

Using Creatio's AI prompt to create the filter for a dynamic folder works best if you specifically ask for that, and if you are as clear and direct as possible about the filtering, conditions.

Related Articles

AI Readiness Checklist for CRM Teams: Is Your CRM System Ready for AI?

Before using AI in Creatio, make sure your CRM data, users, processes, and automation foundation are ready. Use this practical AI readiness checklist for CRM teams.

Build Your Creatio AI Skills with the 2026 AI Summer Program

Join Creatio’s free 2026 AI Summer Program to learn how to identify, build, deploy, and manage AI agents.

Creatio 10x Is Coming: Join the Webinar to Explore the Future of AI-Native CRM

Learn what's new in Creatio 10x and how AI-native CRM, agentic AI, and no-code automation are shaping the future of customer relationship management. Join the upcoming webinar and discover what's next.

Creatio Unlimited Pricing Explained: AI Packages, Costs, Pros & Cons

Learn what Creatio’s new Unlimited pricing model includes, what it doesn’t include, how AI Action packages work, and the pros and cons for businesses evaluating Creatio.

Related Videos