Hi,
How can i sort desc based on modified date, and take the first record of it????
var esqResult = new EntitySchemaQuery(UserConnection.EntitySchemaManager, Object);
esqResult.AddColumn("Id");
Like
Please set the orderDirection property of the needed column in EntitySchemaQuery to sort the records. In order to get the first record from collection use first() or getByIndex(0) function. Here is the example below:
var esq = Ext.create("Terrasoft.EntitySchemaQuery", {rootSchemaName: "Account"});
esq.addColumn("Id");
esq.addColumn("Name");
var datecolumn = esq.addColumn("CreatedOn");
datecolumn.orderDirection = Terrasoft.OrderDirection.DESC;
esq.getEntityCollection(function(result) {
if (result.success) {
var first = result.collection.first();
}
}, this);