Skip to content

Bad request after publish auditlog event #180

@yelisap

Description

@yelisap

Hi colleagues,

We have entities definition as follow. We can see the ServiceProvider from StockTransferTransportSettings entity is an optional fields.

After we adopt "@cap-js/audit-logging", when we create/update/delete this entity it will publish data.modification auditlog automatic.

But if ServiceProvider does not provider, It will send an auditlog event without data_subject.id. Then auditlog API will report 400 Bad Request.

Is it possible not send auditlog event in this case to avoid this issue?

@PersonalData: {
    EntitySemantics: 'DataSubject',
    DataSubjectRole: 'BusinessPartners'
}
entity Carriers : cuid {
    @PersonalData.FieldSemantics
    ID                    : String;
    @PersonalData.IsPotentiallyPersonal
    identifier        : String(60);
    @PersonalData.IsPotentiallyPersonal
    name              : String;
}

@PersonalData: {EntitySemantics: 'Other'}
entity StockTransferTransportSettings {
  ...
  @PersonalData                       : {
    FieldSemantics       : 'DataSubjectID',
    IsPotentiallyPersonal: true
  }
  ServiceProvider                : Association to one Carriers;
}
{
  "data_subject": {
    "role": "BusinessPartners",
    "type": "com.sap.sfm.erptransport.settings.TransportSettingService.ServiceProvider"
  },
  "object": {
    "type": "com.sap.sfm.erptransport.settings.TransportSettingService.StockTransferTransportSettings",
    "id": { "ID": "6adc5fea-d2aa-434e-88cd-56ea3ac09c80" }
  },
  "attributes": [
    { "name": "validityPeriod_validFrom", "new": "2033-03-20" },
    { "name": "validityPeriod_validTo", "new": "2033-03-20" },
    { "name": "mainModeOfTransport_code", "new": "AIR" },
    { "name": "comment", "new": "123" }
  ],
  "uuid": "e41db853-e2ac-48fe-8638-68c25aef1f47",
  "tenant": "$SUBSCRIBER",
  "user": "...",
  "time": "2025-09-05T01:51:35.155Z"
}
{
  "subject.id": "'data_subject.id' property cannot be null or empty"
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions