Reference Product Reviews Patch for SCA Elbrus

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

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

Step 1: Set Permissions for ProductReviews.Service.ss File

  1. In NetSuite, go to Documents > Files > File Cabinet.

  2. In the File Cabinet, go to Web Site Hosting Files > Live Hosting Files > SSP Applications > NetSuite Inc. -X.Y.Z > Development > services.

    Important:

    Replace the string, X.Y.Z, with the version of SCA you are using.

  3. Next to ProductReviews.Service.ss, click Edit.

  4. Go to the Permission tab and check the Enabled box.

  5. From the Execute as Role list, select SC Product Review.

  6. Check the Run Script Without Login box.

  7. Click Save.

Step 2: Create the Override File for ProductReviews.Model.js

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

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

    Find the following code:

                    if (this.loginRequired && !ModelsInit.session.isLoggedIn2())
    {
        throw unauthorizedError;
    } 
    
                  

    Replace it with the following code:

                    if (this.loginRequired && !ModelsInit.session.isLoggedIn3())
    {
        throw unauthorizedError;
    } 
    
                  

    Find the following code:

                    if (ModelsInit.session.isLoggedIn2())
    {
        review.setFieldValue('custrecord_ns_prr_writer', nlapiGetUser() + '');
    } 
    
                  

    Replace it with the following code:

                    if (ModelsInit.session.isLoggedIn3())
    {
        review.setFieldValue('custrecord_ns_prr_writer', nlapiGetUser() + '');
    } 
    
                  

Step 3: 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/ProductReviewsExtension@1.0.0/ns.package.json

                      {
        "gulp": {
          "ssp-libraries": [
            "SuiteScript/*.js"
          ]
        },
        "overrides": {
          "suitecommerce/ProductReviews@X.Y.Z/SuiteScript/ProductReviews.Model.js" : "SuiteScript/ProductReviews.Model.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/ProductReviewsExtension": "1.0.0",
            ...} 
    
                  

Step 4: Test and Deploy Your Patch

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

Step 5: Confirm Custom Record ID and Access Type

  1. In NetSuite, go to Customization > List, Records & Fields > Record Types.

  2. Click the link for the custom record type, Product Reviews.

  3. On the Custom Record Type page for Product Reviews, confirm that ID has the value, customrecord_ns_pr_review.

  4. Confirm that Access Type has Use Permission List selected.

    If the access type is not correct, select Use Permission List from Access Type.

  5. Click Save to save any changes you made.

  6. Repeat steps 1 to 5 for the following custom record types:

    • Product Reviews Attr. Rating – the ID should be customrecord_ns_pr_attribute_rating and the access type should be Use Permission List.

    • Product Reviews Images – the ID should be customrecord_ns_pr_image and the access type should be Use Permission List.

Related Topics

General Notices