Add New Custom Entity Field to the Registration Form Using Extension

Create Custom Entity Field

Go to Customization > Lists, Records & Fields > Entity Fields > New to create a new field as follows:

  • Label — Terms and Conditions
  • ID — _tsandcs
  • Type — Checkbox
  • Store Value — (checked)
  • Applies To > Customer, Web Site — (checked)

Save it.

Create an extension for terms and condition

  • Extension Fantasy Name — Terms and Conditions
  • Extension Name — TermsAndConditions
  • Vendor Name — Example
  • Version Number — 1.0.0
  • Description — Adds a terms and conditions checkbox to the registration form
  • Supports — SuiteCommerce Online
  • Module Name — TermsAndConditions
  • Applies To — Shopping, My Account, Checkout
  • Using — JavaScript, Templates, Sass

Entry Point file

define('Example.TermsAndConditions.TermsAndConditions.Checkout'
, [
    'Example.TermsAndConditions.TermsAndConditions.LoginRegister.View'
  ]
, function
  (
    TermsAndConditionsLoginRegisterView
  )
{
  'use strict';

  return  {
    mountToApp: function mountToApp (container)
    {
      var LoginRegisterPage = container.getComponent('LoginRegisterPage');

      if (LoginRegisterPage)
      {
        LoginRegisterPage.addChildView('Register.CustomFields', function ()
        {
          return new TermsAndConditionsLoginRegisterView
          ({
            LoginRegisterPage: LoginRegisterPage
          })
        });
      }
    }
  };
});

View file

define('Example.TermsAndConditions.TermsAndConditions.LoginRegister.View'
, [
    'Backbone'
  , 'example_termsandconditions_termsandconditions_loginregister.tpl'
  ]
,  function
    (
    Backbone
  , example_termsandconditions_termsandconditions_loginregister_tpl
  )
{
  'use strict';

  return Backbone.View.extend({
    template: example_termsandconditions_termsandconditions_loginregister_tpl
  });
});

Template file

<div class="login-register-register-form-controls-group">
    <label id="login-register-register-custentity_tsandcs" class="login-register-register-form-label">
        <input type="checkbox" name="custentity_tsandcs" id="custentity_tsandcs" value="T">{{translate 'I have read and agree to the <a data-touchpoint="home" data-hashtag="#/terms-and-conditions">Terms and Conditions</a> of this site'}}
    </label>
</div>

Then save and run the extension then deploy it to netsuite

Leave a comment

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