I currently have an Community/Experience Cloud site that is built on LWR

I have an Apex method that is returning the results of a Product data in a ProductModel class

LoadProductConfig method

    public static string LoadProductConfig(string productId, string communityId, string accountId) {
        QuoteModel quote = CreateQuote();

        ProductReader productReader = new ProductReader();
        Id pricebookId = getPriceBookId();
        ProductModel product = productReader.read(productId, pricebookId, UserInfo.getDefaultCurrency()); // get currency from company

        LoadRuleRunner runner = new LoadRuleRunner();
        product = runner.load(productId, quote, null, null, product.configuration, null);
        ProductConfigWrapper pConfigWrapper = new ProductConfigWrapper();
        pConfigWrapper.ProductModel = product;
        pConfigWrapper.QuoteId = String.valueOf(quote.record.Id);
        List<String> optionIds = new List<String>();
        if(product.options.size() > 0)
            for(OptionModel o : product.options)
                pConfigWrapper.ProductImageMap = GetProductImageMap(optionIds, getStoreId(communityId), accountId);
        return JSON.serialize(pConfigWrapper);

ProductModel class

public class ProductModel {
        public Product2 record;
        public Id upgradedAssetId;
        public String currencySymbol;
        public String currencyCode;
        public String[] featureCategories;
        public OptionModel[] options;
        public FeatureModel[] features;
        public ConfigurationModel configuration;
        public ConfigAttributeModel[] configurationAttributes;
        public ConfigAttributeModel[] inheritedConfigurationAttributes;
        public ConstraintModel[] constraints;

This ProductModel class is wrapped in a wrapper class ProductConfigWrapper and represented as the pConfigWrapper object that is serialized and returned as a response of the LoadProductConfig() method

The pConfigWrapper is serialized and returned as a response to the LWC:

      productId: this.bundleId,
      communityId: COMMUNITY_ID,
      accountId: this.resolvedEffectiveAccountId
    }).then((result) => {
      this.currentProductConfig = this.initialProductConfig;
      this.initialWrapper = JSON.parse(result);

When I try to read the serialized pConfigWrapper, using Dev Console, the ProductModel has empty values for a few attributes (i.e. features, options etc.) but is filled for some attributes. Why is this so?

I tried the following solutions:

  1. LWC is missing data returned from apex method
  2. Returned APEX object empty in LWC

But they did not help for me. Any help here is appreciated!

1 Answer 1


I managed to figure this out:

When I used the Developer Console to execute the code as anonymous, it was able to return the values as I was running the context of my own user (i.e. System Administrator) which had access to the SBQQ records.

When I was running in Experience Cloud, it was running in the context of the customer user which had no access to the SBQQ records.

By updating the OWDs for the SBQQ objects & setting up the permission set for the customer user, I was able to get the data to be pushed back to LWC

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .