Prepopulate empty AssociationGroup in catalog


I'm working on a project where I would like to create empty associationgroups for items to avoid having editors/admins having to go into commerce manager and instead be able to work through the catalog admin view.

This is possible in the commerce manager UI as shown in this picture

Associationgroup UI

However I have not found a way to do this programmatically e.g when syncing the catalog from another system. Is this possible in any way?

Currently using versions

EPiServer.CMS version="8.11.0"
EPiServer.CMS.Core version="8.11.0"
EPiServer.CMS.UI version="8.6.0"
EPiServer.CMS.UI.Core version="8.6.0"
EPiServer.Commerce version="8.16.0"
EPiServer.Commerce.Core version="8.16.0"
EPiServer.Commerce.UI version="8.16.0"
EPiServer.Commerce.UI.ManagerIntegration version="8.16.0"
EPiServer.Framework version="8.11.0"

Jan 04, 2016 10:42

Hi Pär,

I typically register these types at Startup with the following code inside an initialization module:

var associationDefinitionRepository = context.Locate.Advanced.GetInstance<GroupDefinitionRepository<AssociationGroupDefinition>>();
associationDefinitionRepository.Add(new AssociationGroupDefinition { Name = "MyGroup" });

I don't see why you couldn't incorporate this into an import process that registers new types that appear in new import files. I don't believe there are any restrictions that require their addition at startup, but I haven't tested that specifically.

Hope this helps,


Jan 07, 2016 18:16

Thank you Matthew, worked like a charm. Many thanks for seeing through my misguided attempts at solving it and providing a simple solution.

Jan 08, 2016 8:21
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.