Need some help with creating a custom list. After adding list membership to a commerce entity (customer) and calling IPersistEntityPipeline, the membership is saved on the customer itself, but the list itself is not created

my code:

var listComponent = customer.GetComponent<ListMembershipsComponent>();
await _commander.Pipeline<IPersistEntityPipeline>().Run(new PersistEntityArgument(customer), context);

the customer entity membership component is showing the MyCustomList entry:

"$type": "Sitecore.Commerce.Plugin.ManagedLists.ListMembershipsComponent, Sitecore.Commerce.Plugin.ManagedLists",
                "Memberships": {
                    "$type": "System.Collections.Generic.List`1[[System.String, mscorlib]], mscorlib",
                    "$values": [

But MyCustomList does not appear under CustomerLists or CommerceLists in the database.

I have set the PlugIn.SQL.Sharding.PolicySet-1.0.0.json:

"$type": "Sitecore.Commerce.Plugin.SQL.ListShardingPolicy, Sitecore.Commerce.Plugin.SQL",
                "Expressions": {
                    "$type": "System.Collections.Generic.List`1[[System.String, mscorlib]], mscorlib",
                    "$values": [
                "TableName": "CustomersLists"

1 Answer 1


Try this:

var listComponent = customer.GetComponent<TransientListMembershipsComponent>();
await _commander.Pipeline<IPersistEntityPipeline>().Run(new PersistEntityArgument(customer), context);

If your entity was already created and you adding list membership to your entity, then you have to use TransientListMembershipsComponent instead of ListMembershipsComponent.

  • List: Normal list represents things that can never change. In other words, you want to store the reference all the time. For example, User's orders. Once an order is created by a user, you will always wish to maintain that reference of user and order.

  • TransientList: Unlike, normal list, this list generally gets used to managing such references temporary basis and things that move from one list to another list quickly. For example, the Status of orders. For each status, there could be a list. And order might get move through one status to another hence list.

TransientListMembershipsComponent is being removed from entity before persisting while ListMembershipsComponent not. Memberships from ListMembershipsComponent get added to the database only when the entity is not persisted. While memberships from TransientListMembershipsComponent will be added every time you add a list to this component and persist entity.

Reference: https://pratiksatikunvar.wordpress.com/2020/03/27/everything-about-lists-in-sitecore-commerce/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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