Reference Product List Patch for SCA 2019.2 to 2024.1

Step 1: Set Permissions for ProductList Files

To implement this patch, set the permissions for the ProductList files.

To set permissions for ProductList.Service.ss:

  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.
  3. Important: You must replace the string, X.Y.Z, with the version of SCA you are using.
  4. Next to ProductList.Service.ss, click Edit.
  5. Go to the Permission tab and check the Enabled checkbox.
  6. From the Execute as Role list, select SC Product List.
  7. Check the Run Script Without Login box.
  8. Click Save.

To set permissions for ProductList.Item.Service.ss:

  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.
  3. Important: You must replace the string, X.Y.Z, with the version of SCA you are using.
  4. Next to ProductList.Item.Service.ss, click Edit.
  5. Go to the Permission tab and check the Enabled checkbox.
  6. From the Execute as Role list, select SC Product List.
  7. Check the Run Script Without Login box.
  8. Click Save.

Step 2: Create the Override Files

Create the Override File for ProductList.Item.Model.js

  1. Following the instructions and in the Patch Using Override Mode procedure, create a new directory and file: /Commons/extensions/ProductList@1.0.0/SuiteScript/ProductList.Item.Model.js
  2. In the new ProductList.Item.Model.js file, find and replace the following line of code with the provided code samples.
  3. Find the following code:
Copy
                  
if (this.configuration.loginRequired && !ModelsInit.session.isLoggedIn2()) {
    throw unauthorizedError;
} 

                
  1. Replace it with the following code:
Copy
                  
if (this.configuration.loginRequired && !ModelsInit.session.isLoggedIn3()) {
    throw unauthorizedError;
} 

                

Create the Override File for ProductList.Item.Search.js

  1. Following the instructions and in the Patch Using Override Mode procedure, create a new directory and file: /Commons/extensions/ProductList@1.0.0/SuiteScript/ProductList.Item.Search.js
  2. In the new ProductList.Item.Search.js file, find and replace the following line of code with the provided code samples.
  3. Find the following code:
Copy
                  
if (this.configuration.loginRequired && !ModelsInit.session.isLoggedIn2()) {
    throw unauthorizedError;
} 

                
  1. Replace it with the following code:
Copy
                  
if (this.configuration.loginRequired && !ModelsInit.session.isLoggedIn3()) {
    throw unauthorizedError;
} 

                

Create the Override File for ProductList.Model.js

  1. Following the instructions and in the Patch Using Override Mode procedure, create a new directory and file: /Commons/extensions/ProductList@1.0.0/SuiteScript/ProductList.Model.js
  2. In the new ProductList.Model.js file, find and replace the following line of code with the provided code samples.
  3. Find the following code:
Copy
                  
if (
    !!_.result(this.configuration, 'loginRequired') &&
    !ModelsInit.session.isLoggedIn2()
) {
    throw unauthorizedError;
} 

                
  1. Replace it with the following code:
Copy
                  
if (
    !!_.result(this.configuration, 'loginRequired') &&
    !ModelsInit.session.isLoggedIn3()
) {
    throw unauthorizedError;
} 

                

Create the Override File for ProductList.ServiceController.js

  1. Following the instructions and in the Patch Using Override Mode procedure, create a new directory and file: /Commons/extensions/ProductList@1.0.0/SuiteScript/ProductList.ServiceController.jss
  2. In the new ProductList.ServiceController.js file, find and replace the following line of code with the provided code samples.
  3. Find the following code:
Copy
                  
let user = ModelsInit.session.isLoggedIn2() ? nlapiGetUser() : 0; 

                
  1. Replace it with the following code:
Copy
                  
let user = ModelsInit.session.isLoggedIn3() ? nlapiGetUser() : 0; 

                

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 Commons directory: /Commons/extensions/ProductList@1.0.0/ns.package.json
Copy
                
{ "gulp": { "javascript": [ "JavaScript/*.js" ] }, "overrides": { "suitecommerce/{ProductList@X.Y.Z/SuiteScript/Configuration.js" : "SuiteScript/ProductList.Item.Model.js", 
"suitecommerce/{ProductList@X.Y.Z/SuiteScript/Configuration.js" : "SuiteScript/ProductList.Item.Search.js",
"suitecommerce/{ProductList@X.Y.Z/SuiteScript/Configuration.js" : "SuiteScript/ProductList.Model.js",
"suitecommerce/{ProductList@X.Y.Z/SuiteScript/Configuration.js" : "SuiteScript/ProductList.ServiceController.js"
}
} 

              
  1. Important: You must 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.
Copy
                
"modules": { "extensions/ProductList": "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.

Leave a comment

Your email address will not be published. Required fields are marked *