Dear Salesforce readers, in this post I want to write about a Vlocity CPQ architecture component: the JSONAttribute. Most of you have probably heard about Vlocity, but I like spending a few words to explain what Vlocity is.

About Vlocity

Vlocity is a 100% Salesforce native solution that enables companies to deliver an omnichannel experience, achieving greater sales and service agility. It has recently won the CRM Watchlist 2017 award, being one of the most disruptive companies in the world.

It provides industry-vertical solutions (Communication & Media, Insurance, and Public Sector) to improve the User Experience and the core functionalities.

In the wide range of functionalities, I want to dwell on the CPQ one, focusing on one of its components: the JSONAttribute.

JSONAttribute

It is a field of the Product, of the line items (Opportunity, Quote, Order), and of the Asset objects. In the CPQ architecture, each line item and asset are composed of physical fields and attributes. Attributes are kind of fields used to describe the product and to be the main target of CPQ rules. They are listed inside the JSONAttribute field as a JSON structure.

Essentially, we can think about the JSONAttribute as a big field container. In addition to the attributes values, this field contains the attributes metadata (i.e. kind of attribute, read-only, visible, etc.). It allows the CPQ architecture to be extremely dynamic. In fact, you can add as many attributes as you want, without exceeding the Salesforce limits.

The JSONAttribute is firstly created during the Product definition. The admin user can use the Vlocity functionalities to configure the Product by adding all the necessary attributes (i.e. the weight, the height, the price, the color and so on). Each attribute is composed of a set of metadata fields which define its structure: the type of the attribute (i.e. number, text, picklist, etc.), the visibility, the editability and so on.

Every time a product is associated with an Opportunity/Quote/Order, by using the Vlocity CPQ Cart, the JSONAttribute is dynamically valued with the Product’s JSONAttribute information.

Essentially, Vlocity brings the Product structure inside the line item structure. It is a very smart feature, isn’t it?

JSONAttribure Structure

Let’s examine the JSONAttribute structure with a concrete example. Suppose to have a pair of shoes and you want to specify their color. You will add the Color attribute to the Product. The JSONAttribute will contain the following JSON item.

As you can see, there are a lot of metadata fields. Let’s see the most important:

  • objectid__c: it is the Salesforce unique identifier for the product
  • categorycode__c: each attribute belongs to a category, for clustering purposes. The category code is the Vlocity unique category identifier
  • categoryname__c: it is the name of the category
  • attributeuniquecode__c: it is the Vlocity unique identifier for the specific attribute
  • attributedisplaysequence__c: it represents the attribute display order
  • attributedisplayname__c: it is the attribute label
  • ishidden__c: if the attribute needs to be displayed or not
  • isreadonly__c: if the attribute is editable or not
  • isrequired__c: if the attribute is required or not
  • valuedatatype__c: the type of the attribute. In this case is Text, but it can be a Picklist, a Number, a Date, and so on
  • value__c: if the attribute has a default value
  • attributeRunTimeInfo: it is a dynamic field that will contain the value of the Product. It will be enriched with other sub-fields once the user will decide the value for the color

It is not so simple to interpret, but you just need to know that a lot of useful information are contained inside these metadata. You will use them to manage your own business logic.

Tip and Tricks

The JSONAttribute is a powerful tool to manage your business logic and there are some tips that I want to share with you:

  • The JSONAttribute is dynamically valued by the Vlocity CPQ Cart, but you can modify it by using AngularJS. The whole Vlocity CPQ Cart is built with AngularJS, so you will be able to apply your own complex logic on the JSONAttribute from the Front End side. It’s great since Salesforce does not allow to apply Front End logic on standard components
  • The product may be composed by sub-products. The JSONAttribute enables to shape this kind of logic without creating custom objects
  • The JSONAttribute can be modified by Apex Code. You just need to create a JSON Parser (we will see how in the next article). Consider doing that, because it is essential when you need to integrate Salesforce with other systems (Back End side) and you want to manage your custom logic
  • The JSONAttribute can be modified by standard Vlocity REST API as well. They can be used for simple CRUD updates
  • If you modify the JSONAttribute with Apex Code, CPQ rules will not be triggered. It’s very important to remind this bullet since you will need to define your own custom logic to run all the rules

Support us with a small donation:

  • LTC Address: La5f6W1rPr5VHFGCrCmPJ3sSa2AiwKZJbU
  • BTC Address: 1FG1j42MUze8jiW7JbgNaUMZxZeu7M1b4f
  • Ripple Address: rPVMhWBsfF9iMXYj3aAzJVkPDTFNSyWdKy     Tag: 562614972
  • ETH Address: 0x0940958167ca9cbd6409999957a011be7907d904
(Visited 1,508 times, 1 visits today)
Francesco Boccassi
Francesco Boccassi

Francesco is what the business chemistry calls a blend between a Pioneer, always looking for the next generation idea, and a Driver, methodical and clear goal minded. With more than 6 years in consulting he has a deep knowledge of CRM and Salesforce. He is now focusing on Blockchain and DApps.

Leave a Comment