Understanding the Vlocity attribute data model (2024)

Understanding the Vlocity attribute data model (2)

Vlocity package comes with a set of pre built UI components (primarily Vlocity cards) which are used to create attributes and link them to Product records. Unless until you’re looking to add some layers of customisation to this standard process, there’s a good chance you won’t be aware of some of the child records that are created when any attribute is added to a Product.

So, how many objects are involved when we tinker with attributes ? And is it possible to create / update the attribute values for a specific Product record using Apex logic ? Read on to figure out…

Overview of Data Model

Following is a brief description of the various objects related to Vlocity attributes.

Vlocity Attribute : Represents the definition of an attribute which can be used for profiling, describing or configuring items tracked in the database. More specifically :

  1. Attributes are used to profile accounts and contacts to describe their interests, preferences and any other information that users desire to track. The same attributes can be used on products, documents and other content to describe the target profile of customers who might be interested in them.
  2. Attributes can allow users to filter a list of available and eligible products shown on an opportunity, quote or order to those matching some criteria.
  3. Attributes can be used to configure individual characteristics of a product on an opportunity, quote or order. For example, the operator may select one of three speeds available on a specific modem.
Understanding the Vlocity attribute data model (3)

Product Child Item : Product Child Items define the component products associated with a grouped package of products or services. Sometimes products are grouped to accommodate specialized pricing. The child items are automatically added to the cart when the parent product is added, so child items are always created when products are sold together. May represent the make up of product offerings, product specifications, resources specifications or service specifications.

Understanding the Vlocity attribute data model (4)

NOTE : For every child product added to a parent product, one Product Child Item record is created to maintain the relationship

Compiled Attribute Override : A compiled attribute override defines the JSON representation net of all attribute overrides for a given product (usually a commercial offer).

Attribute Assignment : The assignment of an Attribute to an object such as an Account, Contact or Product. Product attributes define the default configuration for the product to which they are assigned.

Attributes can be configured against various types of objects (like Accounts, Contacts or Products) in Vlocity. Whenever we link a certain attribute to some object, behind the scenes an Attribute Assignment record is created. Here’s a brief overview of some of the significant fields on Attribute Assignment object.

Understanding the Vlocity attribute data model (5)

NOTE : API names mentioned below are with respect to Vlocity CMT package

Attribute

ID of the Vlocity Attribute assigned to the parent object. API Name of this field is vlocity_cmt__AttributeId__c. This is a Lookup field.

Assigned To Object Id

ID of the parent object to which the attribute is assigned. API Name of this field is vlocity_cmt__ObjectId__c. This is a Text field.

Assigned To Object Name

Type of sObject to which this attribute is assigned. API Name of this field is vlocity_cmt__ObjectType__c. This is a Text field.

Value

Value of this attribute. For example, attribute strength (0–5), or a text value “Jimmy”. API Name of this field is vlocity_cmt__Value__c. This is Text field.

Value Data Type

Data type of this attribute such as text, number, percent or checkbox. Overrides the Value Type field on the assigned Vlocity Attribute. API Name of this field is vlocity_cmt__ValueDataType__c. This is a Picklist field. Following are the picklist options available by default :

  1. Currency
  2. Percent
  3. Text
  4. Number
  5. Checkbox
  6. Date
  7. Datetime
  8. Picklist
  9. Multi Picklist
  10. Lookup

Vlocity allows us to configure products as standalone or as a Parent-Child bundle. In case of later, both Parent and Child products can be linked with their own set of attributes. Child products hold some default attribute values, which can be overridden once Child products are added to a Parent product.

There are various scenarios during Product pricing configuration when Attribute Assignment is created. Let’s go through them in this section.

A Product is created and attributes are linked to this product

The values populated in attribute assignment are as follows :

  1. Attribute : Id of Vlocity Attribute record selected
  2. Assigned To Object Id : Id of the Product record
  3. Assigned To Object Name : Product2
  4. Value : The value entered by user during attribute assignment. If the product is treated as Child product and gets added to some Parent product, then this value acts as the default value for the parent product.

A Child product is created and attributes are linked to this product

Since both Child and Parent products are stored as Product2 records, upon adding attributes to the child product the values populated in attribute assignment show similar behavior :

  1. Attribute : Id of Vlocity Attribute record selected
  2. Assigned To Object Id : Id of the Child product record
  3. Assigned To Object Name : Product2
  4. Value : The value entered by user during attribute assignment.

A Child product is added to a Parent product and values of any attribute assigned to the Child product is overridden

When a Child product is added to a Parent product, a Product Child Item record is created. At this stage, no new attribute assignment records are created. While quoting the benefits provided to a customer, Vlocity uses attribute assignment records related to both Parent and Child product records.

If we wish to quote a certain attribute linked to the Child product but with different value, Vlocity allows us to override the attribute value by creating a new attribute assignment record. Before we override an attribute value, it’s value from the Child product acts as the default value for the Parent product. After overriding the values populated in attribute assignment are as follows :

  1. Attribute : Id of Vlocity Attribute record selected
  2. Assigned To Object Id : Id of the Product Child Item record
  3. Assigned To Object Name : Product Child Item
  4. Value : The value entered by user while overriding the default attribute value.

Following is a code snippet where I am updating Attribute Assignment records for a Product record having record Id : 01t5i0000072GeQAAU in my trial org.

//Fetching the Attribute Assignment records using Object Id
List<vlocity_cmt__AttributeAssignment__c> assignmentList = [SELECT Id FROM vlocity_cmt__AttributeAssignment__c WHERE vlocity_cmt__ObjectId__c = '01t5i0000072GeQAAU'];

//Iterating over Attribute Assignment records
for(vlocity_cmt__AttributeAssignment__c assignment: assignmentList){

//Updating attribute assignment value
assignment.vlocity_cmt__Value__c = 'New Value';

//Updating attribute assignment data type
assignment.vlocity_cmt__ValueDataType__c = 'Text';

}

//Updating Attribute Assignment records
update assignmentList;

Understanding the Vlocity attribute data model (2024)

References

Top Articles
Latest Posts
Article information

Author: Jamar Nader

Last Updated:

Views: 6106

Rating: 4.4 / 5 (55 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Jamar Nader

Birthday: 1995-02-28

Address: Apt. 536 6162 Reichel Greens, Port Zackaryside, CT 22682-9804

Phone: +9958384818317

Job: IT Representative

Hobby: Scrapbooking, Hiking, Hunting, Kite flying, Blacksmithing, Video gaming, Foraging

Introduction: My name is Jamar Nader, I am a fine, shiny, colorful, bright, nice, perfect, curious person who loves writing and wants to share my knowledge and understanding with you.