Has anyone managed to return the count of attachment records from a record. Having trouble validating whether a record has any attachments or not.
Like
1 comments
11:32 Sep 15, 2023
Hello,
You can use the EntitySchemaQuery to get the number of attachments:
onEntityInitialized: function() { this.callParent(arguments); var contactId = this.get("Id"); var esq = Ext.create("Terrasoft.EntitySchemaQuery", {rootSchemaName: "ContactFile"}); esq.addColumn("Contact"); var filter = esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Contact", contactId); esq.filters.add("filter",filter); esq.getEntityCollection(function (result) { if (result.success) { window.alert("This record has " + result.collection.collection.length + " attachments"); } }, this); },
Show all comments