First you need to set permission level for service files.
- In NetSuite, go to Documents > Files > File Cabinet.
- In the file cabinet, go to Web Site Hosting Files > Live Hosting Files > SSP Applications > NetSuite Inc. – X.Y.Z > Development > services.
- Next to ProductReviews.Service.ss, click Edit.
- Go to the Permission tab and check the Enabled box.
- From the Execute as Role list, select SC Product Review.
- Check the Run Script Without Login box.
- Click Save.
To apply patches, follow the steps:
- Create ‘Extensions’ folder in the same directory where ‘Advanced’ and ‘Common’ folders reside.
- Copy ‘ProductReviews.Model.js’ file from Commons/ProductReviews/SuiteScript directory and past into Extensions/ProductList/SuiteScript directory.
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() + '');
}
Paste the following sample code into the new ns.package.json file that you created in the Extensions/ProductReviews directory.
{
“gulp”: {
“javascript”: [
“JavaScript/*.js”
],
“ssp-libraries”: [
“SuiteScript/*.js”
]
},
“overrides”: {
“Commons/ProductReviews/SuiteScript/ProductReviews.Model.js”: “SuiteScript/ProductReviews.Model.js”
}
}
In the distro.json file add the path to newly created extensions.