Cheers to all.
I'm developing my custom UI component in Angular and I need to get some data from Creatio database inside of my component. I discovered there is EntitySchemaQuery class in Creatio's sdk, so I decided to use it, but I'm stuck when I need to retreive data with that ESQ as I didn't find method for that. In classic ESQ there was getEntityCollection method for that. Could you please suggest how do I retrieve data from the database? Either using ESQ or other class, but user's authorization matters.
Here is the code of component.
import { Component, OnInit, Input, Output,
ViewEncapsulation, EventEmitter, SimpleChanges } from '@angular/core';
import { CrtViewElement, CrtInput, CrtOutput, EntitySchemaQuery,
ComparisonType, AggregationType, AggregationEvalType, isGuid} from '@creatio-devkit/common';
@Component({
selector: 'usr-input',
templateUrl: './input.component.html',
styleUrls: ['./input.component.scss'],
encapsulation: ViewEncapsulation.ShadowDom
})
/* Add the CrtViewElement decorator to the InputComponent component. */
@CrtViewElement({
selector: 'usr-input',
type: 'usr.Input'
})
export class InputComponent implements OnInit {
constructor() {}
@Input("recordId")
@CrtInput()
/* The input recordId. */
public recordId!: string;
/* Add decorators to the EventEmitter<string>() event. */
@Output()
@CrtOutput()
/* Track input value changes. */
public valueChange = new EventEmitter<string>();
ngOnInit(): void {
}
ngOnChanges(changes: SimpleChanges) {
console.log(changes);
if (isGuid(changes["recordId"]?.currentValue)) {
let esq = new EntitySchemaQuery("ClvObject");
esq.addAggregationFunctionColumn("Id", AggregationType.Count, "AppCount", AggregationEvalType.All);
esq.filters.addSchemaColumnFilterWithParameter(ComparisonType.Equal, "ClvProject", this.recordId, "currentFilter");
let record = esq.getMetadata();
console.log(record);
}
}
}