2 weeks ago
Hello community! As always, thanks for your help. I have the following problem...
I have a page called "Noticias_Detail.page", this page has two buttons: "Me gusta" and "No me gusta". The first button creates a record in the "NOTICIAPERSONALIKE" Entity database with its "LIKE" property set to "true". Right now everything works fine... so when I come back to this page and press the "No me gusta" button, my idea is to update the property of the previous record, making the "LIKE" property value false. This is my setup:
And this is my odata action to update entity:
When i try to press the "No me gusta" button I get the following error:
I can't figure out what's going on. If I try to access this record in my CAP service, I can see it:
These are the entities in my CAP service (if that helps):
entity NOTICIA : cuid, AUDITORIA {
TITULO : String100;
CUERPO : String5000;
EMPRESA: Association to one EMPRESA;
AREA : Association to one AREA;
AUTOR : Association to one PERSONA;
NOTICIAPERSONALIKES: Composition of many NOTICIAPERSONALIKE on NOTICIAPERSONALIKES.NOTICIA = $self;
}
entity NOTICIAPERSONALIKE : cuid, AUDITORIA {
NOTICIA : Association to one NOTICIA;
USUARIOLIKE : Association to one PERSONA;
LIKE : Boolean default true;
}
I accept any help or suggestion, thanks
To update the likes records when returning you need to target the specific like record. The error message indicates you are trying to target the navigation property from the NOTICIA record instead of the NOTICIAPERSONALIKE record.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the help, I still have the same problem. I don't understand what I'm doing wrong, I'm sharing screenshots of the entire process:
In this view I see all the available news
When I select a particular one, I enter the detail view:
The "No me gusta" button triggers the following action:
And I get the following error:
I've tried many variants and none of them work.
Adding my perspective:
As @bill_froelich mentioned, a single record is something essential.
If I look at the screenshots and the issue explanation, it looks like when perform your first operation whether it's a like or unlike you're able to do the update operation as your target entity set in this case is NOTICIAPERSONALIKE (single record). However, in your edit action, the target entity set is NOTICIAPEROSNALIKES which is a collection of NOTICIAPERSONALIKE.
Therefore, I would either try to target the NOTICIAPERSONALIKE entity set or filter out and try to target the correct single record from the NOTICIAPEROSNALIKES entity set making sure that the update operation is happening only on a single record.
User | Count |
---|---|
70 | |
11 | |
10 | |
10 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.