Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

How to update Product's meta field value

Vote:
 

Hi,

I am unable to update a meta field value using the following code. Neither it's giving error nor saving. Please suggest.

// === Set Context, load SKU and a MetaObject ===/

var entryDto1 = CatalogContext.Current.GetCatalogEntryDto("1",new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryInfo));

MetaDataContext mdContext = CatalogContext.MetaDataContext;
MetaObject metaObj1 = MetaObject.Load(mdContext, entryDto1.CatalogEntry[0].CatalogEntryId, entryDto1.CatalogEntry[0].MetaClassId);

int myMetaFieldValue = 3;


MetaHelper.SetMetaFieldValue(mdContext, metaObj1, "myMetaFielddName", new object[] { myMetaFieldValue });
metaObj1.AcceptChanges(mdContext);

entryDto1.AcceptChanges();
CatalogContext.Current.SaveCatalogEntry(entryDto1);

#180257
Jul 04, 2017 12:06
Vote:
 

Just realize that above code is working but in a strange way. Sometime records updated immediatly while sometime it takes approx 20-30 minutes. Not sure , why. Can someone explain what could be the reason.

#180268
Jul 04, 2017 16:48
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.