1

I am creating a catalog from code.

_createCatalogCommand.Process(context.CommerceContext, AcogConstants.CatalogName, "My Catalog");

Process works. However, if clean the environment and re-run the process, I get new SitecordIds. This means that I have to manually go into Sitecore and reset a number of values to point to the new catalog items. I do not see a way with the CreateCatalogCommand or EditCatalogCommand to set the SitecoreId to a specific ID. How can I do this?

1

OK. This was very simple. Just needed to run persist entity after create command:

var category = await _createCategoryCommand.Process(context.CommerceContext, catalogId, categoryName, categoryDisplayName, description);

category.SitecoreId = SomeFunctionToGetSitecoreId();

await _persistEntityPipeline.Run(new PersistEntityArgument(category), context);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.