1

I saw from the docs that sitecore commerce has a managed list feature that can be used to mantain and return a list of entity (CommerceEntity).

I have been used it to get the list of pending orders and stuff like that. However those list were out-of-the-box in the commerce engine.

Now I would like to create a new managed list which returns a list of orders that have a custom status, and keep it up-to-date when an order change its status e.g. from "Pending" to the custom one.

How can I do that?

3

Managed lists are just strings, they're not registered anywhere. You can add an order to a custom one by adding it to the Orders ListMembershipComponent or TransientListMembershipComponent (tl;dr the latter in your case) and then persisting the entity using IPersistEntityPipeline.

Implementation-wise, the SQL plugin has pipeline blocks in IPersistEntityPipeline which create back-references for any managed lists.

Regular list memberships remain two-way (list to entity, and entity to list via the component) and typically represent things that can never change (all orders are in the Orders list as well as the Customer-{id}-Orders list).

Transient list memberships are meant for things that can change, like status lists. As such, the SQL plugin block removes the component from the entity after they create the back-references resulting in a one way (list to entity)

You can find some great examples of changing status + assigning transient list memberships by peeking at the blocks in ICreateOrderPipeline / IPendingOrdersMinionPipeline / IReleasedOrdersMinionPipeline

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.