Start a conversation

Solution AddOn Attribute Missing on Product Definition Causing JavaScript Error

Problem

When creating a new solution using a specific Product Definition, a JavaScript error occurs:

"TypeError: Cannot convert undefined or null to object"

The error prevents the solution from loading or saving properly. The error typically occurs in the CloudSense Solution Management Console or Configurator UI.

Cause

The error occurs when a Product Definition is missing the "Solution AddOn" attribute. This attribute is required by the CloudSense Configurator to identify and manage add-on products within a solution.

When the attribute is missing, the JavaScript code that processes add-ons (e.g., AddonService.fetchAddons) attempts to access properties of an undefined or null object, causing the error.

Technical Details

The CloudSense Configurator expects the "Solution AddOn" attribute to be present on all Product Definitions that support add-on products. This attribute is used to:

  1. Identify which products in the solution are add-ons.
  2. Manage the relationship between the main product and its add-ons.
  3. Populate the add-on selection UI in the Solution Management Console.

If the attribute is missing, the Configurator cannot properly initialize the add-on management logic, resulting in the JavaScript error.

Resolution

Step 1: Identify the Affected Product Definition

  1. Note the Product Definition name or ID from the error message or the solution you were attempting to create.
  2. Navigate to Setup > Custom Metadata Types > Product Definition (or the equivalent custom object in your org).
  3. Locate the Product Definition record.

Step 2: Verify the Missing Attribute

  1. Open the Product Definition record.
  2. Navigate to the Attributes related list.
  3. Check if the "Solution AddOn" attribute exists.
  4. If it does not exist, proceed to Step 3.
  5. If it exists but is inactive, activate it and skip to Step 4.

Step 3: Create the "Solution AddOn" Attribute

  1. Click New in the Attributes related list.
  2. Populate the following fields:
  3. Attribute Name: Solution AddOn
  4. API Name: Solution_AddOn (or follow your org's naming convention)
  5. Data Type: Lookup or Text (depending on your implementation; typically Lookup to a Product Definition or Product record)
  6. Required: False (unless add-ons are always required for this product)
  7. Visible: True
  8. Editable: True
  9. Save the attribute.

Step 4: Refresh the Product Definition Cache

After creating the attribute, the Product Definition cache may need to be refreshed:

  1. Navigate to Setup > Custom Settings > csutil__JSON_Data__c.
  2. Click Manage and locate the entry for your Product Definition (if applicable).
  3. Delete the entry to force a cache refresh, or wait for the cache to expire (typically 24 hours).

Alternatively, you can use the Salesforce Developer Console to clear the cache:

// Execute in Developer Console > Debug > Open Execute Anonymous Window
cscfga.ProductDefinitionCache.clearCache();

Step 5: Test the Solution

  1. Navigate to the Solution Management Console.
  2. Attempt to create a new solution using the affected Product Definition.
  3. Verify that the solution loads without the JavaScript error.
  4. Verify that add-ons (if applicable) are displayed and selectable.

Prevention

  • Product Definition Template: When creating new Product Definitions, use a template that includes all required attributes, including "Solution AddOn".
  • Validation Rule: Consider implementing a validation rule or process builder to ensure that all Product Definitions include the "Solution AddOn" attribute before they are activated.
  • Documentation: Maintain internal documentation listing all required attributes for Product Definitions in your org.

Additional Notes

  • The exact name and API name of the "Solution AddOn" attribute may vary depending on your CloudSense implementation. Check with your CloudSense administrator or refer to your org's configuration documentation.
  • If your Product Definition does not support add-ons, you may still need to create the attribute with a default or null value to prevent the JavaScript error.
  • This issue typically occurs after a new Product Definition is created or after a CloudSense package upgrade that introduces new attribute requirements.
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Priyanka Bhotika

  2. Posted

Comments