I am trying to remove the catalog entry relation row but after calling the CatalogEntryRelation.RemoveCatalogEntryRelationRow function the changes are not reflected in the database. Below is the snippet of code I am using. Am I missing anything?
Entry prod = CatalogRef.GetCatalogEntry(MasterSKU); CatalogRelationDto skuRelation = null; skuRelation = CatalogRef.GetCatalogRelationDto(newEntryRow.CatalogEntryId); bool relationshipFound = false; // CatalogRelationDto.CatalogEntryRelationRow[] entryRelations = skuRelation.CatalogEntryRelation.Select(x => x.RelationTypeId == "ProductVariation"); List<CatalogRelationDto.CatalogEntryRelationRow> rowsToDelete = new List<CatalogRelationDto.CatalogEntryRelationRow>(); for(int i=0; i<skuRelation.CatalogEntryRelation.Count;i++) { CatalogRelationDto.CatalogEntryRelationRow currRelation = skuRelation.CatalogEntryRelation[i]; if (currRelation.ParentEntryId != prod.CatalogEntryId) { skuRelation.CatalogEntryRelation.RemoveCatalogEntryRelationRow(currRelation); } } if (skuRelation.HasChanges()) { CatalogRef.SaveCatalogRelationDto(skuRelation); }
Thanks,
Syed
Hi,
I believe that correct way is to do call Delete on the row:
Thanks Quan,
I started with .Delete() as my first option but that did not work as well. Do we need to call acceptChanges() after the .Delete()?
Quan,
Calling the acceptChanges made it work. Thanks for your help.
I am trying to remove the catalog entry relation row but after calling the CatalogEntryRelation.RemoveCatalogEntryRelationRow function the changes are not reflected in the database. Below is the snippet of code I am using. Am I missing anything?
Thanks,
Syed