Hi all,
Have you played with Freedom UI Sdk yet ?
Have you any idea of how to execute an esq ?
Best regards
Like
Hello,
Thank you for reaching out.
Could you please clarify what issue do you have and what is your business task?
Thanks in advance.
Best regards,
Anastasiia
Anastasiia Marushenko,
Hi need to be able to do the following, but in freedom UI :
setDefaultLieu: function(clientFinalId) { if(!this.get("UsrLieu")) { var esq = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "UsrLieu" }); esq.addColumn("Id"); esq.addColumn("UsrName"); var esqAccountFilter = esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "UsrAccount", clientFinalId); esq.filters.add("esqAccountFilter", esqAccountFilter); esq.getEntityCollection(function(result) { if (result.success) { debugger; var collection = result.collection; if(collection.collection.length == 1) { var entity = collection.getByIndex(0); this.set("UsrLieu",{value: entity.get("Id"), displayValue: entity.get("UsrName")}); } } else { this.showInformationDialog("Request error. Please contact your system administrator"); } }, this); } }
Hello,
Freedom UI allows to call esq query (for example using the code below when the esq call is connected to attribute change):
{ request: "crt.HandleViewModelAttributeChangeRequest", handler: async (request, next) => { if (request.attributeName === 'DateTimeAttribute_m2b4mok') { var esq = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "Account" }); esq.addColumn("CreatedOn"); var esqFilter = esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Id", "1e5d4e6e-13db-43c8-8b4e-fc04d514932b"); esq.filters.add("esqFilter", esqFilter); esq.getEntityCollection(function (result) { if (result.success && result.collection.getCount() > 0) { result.collection.collection.each(function(item) { request.$context.UsrEndDate = item.values.CreatedOn; }, this); } }, this); } return next?.handle(request); }, }
but the issue is that esq is async and we always get the value for the column after all the handlers are completed. I will ask our core R&D team to add esq support in Freedom UI. Thank you for helping us in making the app better!
Oleg Drobina,
There is already support for EntitySchemaQuery in the new Creatio DevKit SDK that returns a promise that you can await rather than using a callback as in the Ext version. I can't seem to get it to work yet although it's difficult when I'm just guessing at how it is used since there is no documentation on it yet - or by trying to figure it out by examining the code (which is very difficult since it's minified and transpiled from TS).
If you could get one of the devs to provide a small sample using ESQ from the DevKit SDK that would be fantastic.
Ryan
Jerome,
I've been told the intended use on a Freedom UI page is to use the Model class for retrieving, adding, updating, deleting data from client-side code on a Freedom UI page (instead of using ESQ).
I've started some articles on this topic, the first one for retrieving a single record here: https://customerfx.com/article/retrieving-a-record-via-the-model-class-…
I'll have several more articles coming on doing queries with the Model class. I actually quite like using the model class so far, but there are for sure some things that I am not sure it can handle like ESQ - I hope we'll see ESQ become available in Freedom UI pages, the classes are all in the DevKit SDK - except for the one that matters (the QueryExecutor to actually execute the ESQ).
Ryan