722 views
In this article, we will look at how we can enable the Disassociate Sellable Item from Inventory Set, Edit Sellable Item Inventory and Transfer Inventory actions when viewing sellable item and variant entity views in BizFx.
For entities that have been configured to utilise entity versioning (catalogs, categories, and sellable items), via the VersioningPolicy in the VersioningPolicySet, all actions are disabled by default when the entity has been published.
The actions that are enabled are due to those actions being registered in the EntityVersionsActionsPolicy in the VersioningPolicySet, under the AllowedActions property.
There is no need to restrict the Inventory Sets actions in the Sellable Item and Variant entity views as they can be executed from within the Inventory Manager.
Note: Inventory association and disassociation actions apply to all entity versions of the sellable items as inventory records don’t have strong ties to specific entity versions as inventory is not content.
To enable the Inventory Sets actions, simply add their action names to the AllowedActions, and deploy and bootstrap.
{ "$type": "Sitecore.Commerce.Plugin.EntityVersions.EntityVersionsActionsPolicy, Sitecore.Commerce.Plugin.EntityVersions", "AllowedActions": { "$type": "System.Collections.Generic.List`1[[System.String, mscorlib]], mscorlib", "$values": [ "AddEntityVersion", "AddCatalog", "DeleteCatalog", "AddCategory", "DeleteCategory", "AddSellableItem", "DeleteSellableItem", "AddBundle", "AssociateCategoryToCategoryOrCatalog", "AssociateSellableItemToCatalog", "AssociateSellableItemToCategory", "DisassociateItem", "MakePurchasable", "DisassociateSellableItemFromInventorySet", "EditSellableItemInventory", "TransferInventory" ] } }
These actions can now be performed, regardless of whether or not the entity has been published.