If I want to read a business object on a page (or component) and want to get a specific instance, I could specify a where clause in the property read configuration:
But this doesn’t seem to return the record expected (don’t get any records actually).
I could make the reading ‘On Demand’ instead and use an initialize method to read with a where clause.
What’s the best practice here?
From Dave:
I never use the read config to set where clauses. It rarely gives me what I expect. The key to debugging this is to look at the generated code:
ngOnInit() {
this.apexDesignerEditService.registerComponentInstance(this);
this.contentSearch = new ContentSearchFormGroup({
onReadComplete: () => {
this.contentSearchTopicLinks = this.contentSearch
.contentSearchTopicLinks as ContentSearchTopicLinkFormArray;
},
where: { name: null },
include: {
contentSearchTopicLinks: { include: { topic: {} } },
},
http: this.httpClient,
read: 'Automatically',
save: 'Automatically',
});
So switching to on-demand and setting the where option in best.