SCA and Site Builder Vinson, Mont Blanc, and Denali

To implement this patch, create a custom module to override the Utils.js JavaScript file, which is part of the SspLibraries module.

If you are unfamiliar with implementing patches for SuiteCommerce Advanced (SCA), refer to:

Step 1: Create the Override File for Utils.js

  1. Following the instructions in the Patch Using Override Mode procedure, create a new directory and file: /Modules/extensions/SspLibrariesExtension@1.0.0/SuiteScript/Utils.js

  2. In the new ProductReviews.Utils.js file, find and replace the following line of code with the provided code samples.

    Find the following code:

                    ,   recordTypeExists: function (record_type_name)
          {
             try
             {
                nlapiCreateRecord(record_type_name);
             }
             catch (error)
             {
                return false;
             }
             return true;
          }
    
          // @method recordTypeHasField returns true if and only if the given field_name exists on the given record_type_name.
          // @param {String} record_type_name @param {String} field_name @return {Boolean} 
       ,   recordTypeHasField: function (record_type_name, field_name)
          {
             try
             {
                var record = nlapiCreateRecord(record_type_name);
                return _.contains(record.getAllFields(), field_name);
             }
             catch (error)
             {
                return false;
             }
          } 
    
                  

    Replace it with the following code:

                    ,   recordTypeExists: function (record_type_name)
          {
             try
             {
                nlapiCreateSearch(record_type_name, null, [], []);
             }
             catch (error)
             {
                return false;
             }
             return true;
          }
    
          // @method recordTypeHasField returns true if and only if the given field_name exists on the given record_type_name.
          // @param {String} record_type_name @param {String} field_name @return {Boolean}
       ,   recordTypeHasField: function (record_type_name, field_name)
          {
             try
             {
                nlapiLookupField(record_type_name, 1, field_name);
                return true;
             }
             catch (error)
             {
                return false;
             }
          } 
    
                  
  3. Save the file.

Step 2: Prepare the Developer Tools for Your Patch

When preparing the Developer Tools for your patch as described in the Patch Using Override Mode procedure, perform the following actions:

  1. Paste the following sample code into the new ns.package.json file that you created in the directory: /Modules/extensions/SspLibrariesExtension@1.0.0/ns.package.json

                      {
        "gulp": {
          "ssp-libraries": [
            "SuiteScript/*.js"
          ]
        },
        "overrides": {
          "suitecommerce/SspLibraries@X.Y.Z/SuiteScript/Utils.js" : "SuiteScript/Utils.js"
        }
      } 
    
                  
    Important:

    Replace the string, X.Y.Z, with the version of the module in your implementation of SCA.

  2. Open the distro.json file in the root SCA development directory and then add your custom module to the modules object as described in the Patch Using Override Mode procedure. The following sample shows the value to add to the list of existing values that follow the “modules” key.

                         "modules": {
            "extensions/SspLibrariesExtension": "1.0.0",
            ...} 
    
                  

Step 3: Test and Deploy Your Patch

Follow the instructions provided in the Patch Using Override Mode procedure to test and deploy your patch.

Related Topics

General Notices