cap-js / change-tracking

CDS plugin providing out-of-the box support for automatic capturing, storing, and viewing of the change records of modeled entities.
https://cap.cloud.sap/docs
Apache License 2.0
20 stars 8 forks source link

Change history/tracking does not work on multiple records #82

Closed vishalkwatra closed 2 months ago

vishalkwatra commented 6 months ago

Hi Team,

I am trying to post the data via CQL after enabling change tracking for the service and connecting to it. const srv = await cds.connect.to("MasterDataMapService"); const masterEntity = srv.entities[entity]; const insertResult = await INSERT.into(masterEntity).entries(aInsertData);

Above Insert Query shows the change tracking only if I insert one record into it, otherwise it does not show any change tracking. Can you please check on this?

Change tracking annotation file source code: using { MasterDataMapService } from './masterdatamap-service'; using from '@cap-js/change-tracking';

annotate MasterDataMapService.TaxCodeMap with @title: 'Tax Code' @changelog: [author, timestamp]{ companyCode @changelog; sourceTaxCode @changelog; targetTaxCode @changelog;

} annotate sap.changelog.aspect @(UI.Facets: [{ $Type : 'UI.ReferenceFacet', ID : 'ChangeHistoryFacet', Label : '{i18n>ChangeHistory}', Target: 'changes/@UI.PresentationVariant', ![@UI.PartOfPreview] }]);

annotate sap.changelog.ChangeView with @( UI.LineItem : [ { Value: modification, @HTML5.CssDefaults: { width: 'auto' }}, { Value: createdAt, @HTML5.CssDefaults: { width: 'auto' }}, { Value: createdBy, @HTML5.CssDefaults: { width:'auto' }}, { Value : attribute, @HTML5.CssDefaults: { width:'auto' }}, { Value : valueChangedFrom, @HTML5.CssDefaults: { width:'auto' }}, { Value : valueChangedTo, @HTML5.CssDefaults: { width:'auto' }},

] );

Regards, Vishal Kwatra

nkaputnik commented 6 months ago

Hello @vishalkwatra can you create a sm all repo to reproduce the example, so that I can debug it?