Configuration Manager

Estimated reading: 4 minutes 4 views

Introduction

The Configurator Manager is an Apex Class that it’s used as the start point for any Product / Order configuration. This is the class that is invoked from the different LWC components in the UI and also it would be the one to use when creating any order without User Interface.

Main Capabilities / Methods

Load Cart Context

It’s in charge of identifying and loading the current context. For instance, when you are in a new Order, the context is not much more than the Account Id, but when you are working on an existing Order the context would be all the current Order Items and its setup.

It also identify if you are working directly on an Account or in an existing order, as technically is possible to create an Order on the fly without creating it first.

Get Product Setup

For a given Product Id it check if there is any Active version and in that case it return the Product Definition with all it’s attributes, relationships, etc.

This method leverage the OrgCache using the CatalogCacheManager [ CatalogCacheManager ]({{< relref “catalogCacheManager” >}}) to retrieve the Product Definition from the cache. If it’s not loaded, the CatalogCacheManager automatically loads it.

Populate IDs

Any Product, or child component along the different Order Items in an Order must have an Unique ID (UUID) when setting them up in order to be able to know which exact order item or component you are working on, as an Order could have the same product more than once, and a Product could have the same component more than once too.

This UUID’s are used for different reasons:

  • Identify products/components when there are more than one of the same Product Definition.
  • Be able to match the Agreement to the Asset when activating the Order, as the Asset will have the same UUID as the Order Item.

Load Order

It loads the current order in case there is one.

  1. It uses the [ Object Tree engine ]({{< relref “/docs/technical/core/objecttree” >}}) to load the current Order with the ‘Order’ Object Tree. It will load the order, the order items, and the related attributes.
  2. It applies the [ Data Map ]({{< relref “/docs/technical/core/datamap” >}}) named ‘Cart to Order’ in reverse mode. This is, Order to Cart, to convert the Order Item structure in the structure understood by the Configuration Engine(ConfigurationWrapper).
  3. It retrieves the Product Definition for each Order Item.
  4. It merges each Order Item configuration into the corresponding Product Definition. This way, the resulting structure is the same as if the product would have been setup through the configurator.

Pre-Setup Product

It executes different automated configuration on the components and attributes. For instance, it checks if there is any default and mandatory component to select it automatically and prevent it from being unselected.

More functionality will be likely added to this method in the future.

Checkout

It validates the order and saves it into database in the Order / Order Item / Order Item Attribute SOBJECT structure:

  1. It executes the Validate Order method (See next section) to make sure all requirements (Validation Rules, Cardinality and Compatibility Rules) are met.
  2. If any rules is not satisfied, the resulting errors are returned.
  3. If all rules are met, then the ‘Cart to Order’ [ Data Map ]({{< relref “/docs/technical/core/datamap” >}}) is applied to the current contex (ConfigurationWrapper) and then persisted into the Database through the [ Persistence Manager ]({{< relref “/docs/technical/core/persistence” >}}).

Validate Order

It executes the defined validation rules for each product/order item and the Compatibility Rules.

Additionally, if there is any, it also executes the [ Custom Validations ]({{< relref “customValidations” >}}) which are custom Apex Rules that you can implement.

Leave a Comment

       
Euphoria, forever till the end of times

Euphoria

Share this Doc

Configuration Manager

Or copy link

CONTENTS