You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I generated a sample application using cds add samples.
I renamed the field ID of Books to BookID in db/schema.cds and updated test data too.
entity Books : managed {
key BookID : Integer;
@mandatory title : localized String(111);
descr : localized String(1111);
@mandatory author : Association to Authors;
genre : Association to Genres;
stock : Integer;
price : Decimal;
currency : Currency;
image : LargeBinary @Core.MediaType : 'image/png';
}
I enabled change tracking for the entity Books of AdminService with annotations:
annotate AdminService.Books with @changelog : [BookID] {
title @changelog;
descr @changelog;
price @changelog;
currency @changelog;
stock @changelog;
}
Now when I try to change the title of Book with title "Catweazle" using fiori preview for Books entity, the application reports error.: Error: "ID" not found in the elements of "AdminService.Books"
I see in the console the following error.
odata] - POST /odata/v4/admin/$batch
[odata] - > PATCH Books(BookID=271,IsActiveEntity=false)
[odata] - > draftPrepare Books(BookID=271,IsActiveEntity=false)/AdminService.draftPrepare
[odata] - > draftActivate Books(BookID=271,IsActiveEntity=false)/AdminService.draftActivate {
'$select': 'BookID,HasActiveEntity,HasDraftEntity,IsActiveEntity,author_AuthorID,createdAt,createdBy,currency_code,descr,genre_code,modifiedAt,modifiedBy,price,stock,title',
'$expand': 'DraftAdministrativeData($select=DraftIsCreatedByMe,DraftUUID,InProcessByUser),author($select=ID,name),genre($select=ID,name)'
}
[cds] - Error: "ID" not found in the elements of "AdminService.Books"
at stepNotFoundInCombinedElements (D:\book-shop\node_modules\@cap-js\db-service\lib\infer\index.js:807:15)
at D:\book-shop\node_modules\@cap-js\db-service\lib\infer\index.js:543:13
at Array.forEach (<anonymous>)
at inferQueryElement (D:\book-shop\node_modules\@cap-js\db-service\lib\infer\index.js:489:18)
at processToken (D:\book-shop\node_modules\@cap-js\db-service\lib\infer\index.js:371:11)
at Array.forEach (<anonymous>)
at walkTokenStream (D:\book-shop\node_modules\@cap-js\db-service\lib\infer\index.js:375:19)
at inferQueryElements (D:\book-shop\node_modules\@cap-js\db-service\lib\infer\index.js:344:16)
at infer (D:\book-shop\node_modules\@cap-js\db-service\lib\infer\index.js:69:22)
at cqn4sql (D:\book-shop\node_modules\@cap-js\db-service\lib\cqn4sql.js:47:20) {
id: '1344032',
level: 'ERROR',
timestamp: 1701262020937
}
There were no issues before I renamed the field.
The text was updated successfully, but these errors were encountered:
Hi @dinurp
this is not a bug or issue with Change-Tracking, this is a limitation of Fiori Draft.
Draft-Enabling an entity requires the entity to have a GUUID based ID, so this error message has nothing to do with the Plug-in.
Hi Nick,
The issue remains even when the type of the field is changed to UUID. Fiori draft does not mandate that the keys are named ID. For localized entities, the generated key is named ID_texts. It is not evident in the stack trace. But, the query that causes the crash is from change tracking.
BTW: The type Integer was in the generated sample with cds add samples and it works just fine when change tracking is not used.
Regards,
Dinu
Hello @dinurp
we will look into this. In the meantime, since this is an open source project: If you can debug your project and pinpoint to specific pieces of the plug-in code, this would be a huge help for us.
Dear Nick,
Here is the fix that worked for me. It may not cover all the cases, but solved the I issue I faced. diff-support-naming-keyfield.txt
Regards,
Dinu
I generated a sample application using
cds add samples
.I renamed the field
ID
of Books toBookID
indb/schema.cds
and updated test data too.I enabled change tracking for the entity
Books
ofAdminService
with annotations:Now when I try to change the title of Book with title "Catweazle" using fiori preview for Books entity, the application reports error.:
Error: "ID" not found in the elements of "AdminService.Books"
I see in the console the following error.
There were no issues before I renamed the field.
The text was updated successfully, but these errors were encountered: