I am trying to create a new campaign for a new promotion in a initialization module, but every time I try to run it, SalesCampaignFolder.CampaignRoot is null. Below is my current code.
_contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
_campaign = _contentRepository.GetDefault<SalesCampaign>(SalesCampaignFolder.CampaignRoot);
Thanks for any help.
Hi - Make sure your initialization module depends on EPiServer.Commerce.Initialization.InitializationModule
Inside the context of Initialize(InitializationEngine context), you don't have to use ServiceLocator, use
Ah I see, I was using the Framework InitializationModule for the module dependency. That seemed to do the trick. Thanks!