Announcements
RetailMediaProductRelationEntity
Public void initializeEntityDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx) { super(_entityCtx, _dataSourceCtx); if (_dataSourceCtx.name() == dataEntityDataSourceStr(RetailMediaResourcesEntity, RetailMediaResource)) { // We have to do this at this point so that mapEntityToDataSource can perform the correct mappings using the sub-type // otherwise the fields in the super-type are not mapped and saved properly. if (_dataSourceCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Insert || this.InstanceRelationType == 0) { // Based upon the type (currently RetailMediaResource only has one - RetailImageResource // set so that the InstanceRelationType gets the proper value (e.g. 12876 instead of 5845 or // tableNum(RetailImageResource) and tableNum(RetailMediaResource)). _dataSourceCtx.setBuffer(new DictTable(tableNum(RetailImageResource)).makeRecord()); _dataSourceCtx.getBuffer().initValue(); _dataSourceCtx.skipInitValue(true); } } }
Why RetailMediaProductRelationEntity fails:
You're only providing 2 of the 4 key fields ProductNumber and ResourceId. The other two CatalogId, InternalOrganizationPartyNumber default to empty/zero on first import. On second import they again default to empty/zero so the DB finds that exact composite key already exists and throws a duplicate key error instead of doing a find+skip or upsert. Overrides persistEntity to handle duplicate key during DMF import public boolean persistEntity(DataEntityRuntimeContext _entityCtx) { RetailMediaProductRelationEntity entityRecord; RetailMediaProductRelation existing; if (_entityCtx.getOperation() == DataEntityDatabaseOperation::Insert) { entityRecord = _entityCtx.getEntityRecord() as RetailMediaProductRelationEntity; if (entityRecord) { /// your custom logic if (existing.RecId) { // Duplicate record found — skip to return success return true; } } } return super(_entityCtx); } Please find the screenshot for your ref. The relation includes both entities. If the issue still persists after following them, please raise a query, and we will be happy to support you further. Thanks, If you found it helpful, please consider marking it as verified — it may be useful for others in the future!
ProductNumber
ResourceId
CatalogId
InternalOrganizationPartyNumber
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Jump in, show your community spirit, and win prizes!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Abhilash Warrier 681 Super User 2026 Season 1
André Arnaud de Cal... 598 Super User 2026 Season 1
Giorgio Bonacorsi 579