Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
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()?
Syed
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