Tip 12: Add new page to suitecommerce advance website to set password and login to myaccount

This is my first blog on Netsuite suitecommerce. So lil bit nervous as I am not an expert on suitecommerce advance feature on Netsuite. But I am happy to share something on this which I have explored on my own. You are most welcome to add comments…

Some days before, I got a requirement as follows…

“Employee of the company related to the website will create a customer record with some temporary password. Once customer record is created, An email will be sent to customer with the link to reset the password. As soon as customer resets the password, he should be redirected to his account.”

When I started working on the requirement, I had faced some issues to achieve the result.

-I didn’t have much knowledge on SSP Application.

-Its difficult to get a clear idea on SSP application flow.

-The requirement was having both Password reset as well as login in one go.

I checked how Reset Password is working in SSP application.

Similarly I approached with some add-on.

Step 1: Create a template for Set Password let’s say “new_password.txt“.

Step 2: Decide, where do you want to attach that template to show that page in UI. According to that update the respective View.js file.

I have updated the Login.View.js file as I want to display the same in login touchpoint.

Step 3: As the login part is attached to Account module in Models.js, create a new file under Accounts module called Account.NewPassword.js which is responsible for client-side validation of the form as well as attach the respective .ss file if needed.

Step 4: Create a .ss file let’s say account.newpassword.ss under services folder and put all your back-end logic that will be executed when form is submitted.

So as per my current requirement, I have added code to get the customer related information from the parameter passed as well as new password and confirm password from the field.

To Reset the password, I am calling an suitelet script to reset the password, as I was facing some issue on doing the same in .ss file. But I am sure, we can do it in .ss file too.

On success of reset password from suitelet, I am calling the Account.login(email, password) to login to the site and redirect to my account page.

Remember: All new files added must be reflected in global.configuration.js file and all code should be reflected in Application.js. Else, you will face some issue of file/code not found.

I hope, you must have got some basis idea on how to add a new page and its back-end execution flow.

For any query, please add your comments below. I will surely get back to you.

Suggestions/corrections are appreciated 🙂

 

Thanks,

Asha