How to apply Product List patch for SCA 2019.2 – 2024.1 versions

There are two ways that we can apply patches, the first one is Using Extend Mode, and the second one is using Override Mode.

Here we will go through the second approach – Using Override Mode.

To apply patches for Product List:

  • Download the source code from ‘Development’ directory in file cabinet.
  • Create an ‘Extensions’ folder in the same directory where the ‘Advanced’ and ‘Commons’ folders reside.
  • Create a folder for the extension Product List.
  • Copy the following suitescript files from Commons/ProductList/SuiteScript directory and past into Extensions/ProductList/SuiteScript directory.
  1. ProductList.Item.Model.js
  2. ProductList.Item.Search.js
  3. ProductList.Model.js
  4. ProductList.ServiceController.js
  • In the new ProductList.Item.Model.js file, find and replace the following line of code with the provided code samples.
  • Find the following code:
if (this.configuration.loginRequired && !ModelsInit.session.isLoggedIn2()) {
    throw unauthorizedError;
}

  • Replace it with the following code:
if (this.configuration.loginRequired && !ModelsInit.session.isLoggedIn3()) {
    throw unauthorizedError;
}
  • In the new ProductList.Item.Search.js file, find and replace the following line of code with the provided code samples.
  • Find the following code:
if (this.configuration.loginRequired && !ModelsInit.session.isLoggedIn2()) {
    throw unauthorizedError;
}

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

  • In the new ProductList.Model.js file, find and replace the following line of code with the provided code samples.
  • Find the following code:
if (
    !!_.result(this.configuration, 'loginRequired') &&
    !ModelsInit.session.isLoggedIn2()
) {
    throw unauthorizedError;
}

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

  • In the new ProductList.ServiceController.js file, find and replace the following line of code with the provided code samples.
  • Find the following code:
let user = ModelsInit.session.isLoggedIn2() ? nlapiGetUser() : 0;

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

Paste the following sample code into the new ns.package.json file that you created

{

    “gulp”: {

        “javascript”: [

            “JavaScript/*.js”

        ],

        “ssp-libraries”: [

            “SuiteScript/*.js”

        ],

        “autogenerated-services”: {

            “ProductList.ServiceController.Service.ss”: “ProductList.ServiceController”

        }

    },

    “overrides”: {

        “Commons/ProductList/SuiteScript/ProductList.Item.Model.js”: “SuiteScript/ProductList.Item.Model.js”,

        “Commons/ProductList/SuiteScript/ProductList.Item.Search.js”: “SuiteScript/ProductList.Item.Search.js”,

        “Commons/ProductList/SuiteScript/ProductList.Model.js”: “SuiteScript/ProductList.Model.js”,

        “Commons/ProductList/SuiteScript/ProductList.ServiceController.js”: “SuiteScript/ProductList.ServiceController.js”

    }

}

Leave a comment

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