Legacy platform

Adding a text field with custom validation on the create consumer screen

You can add a text field in any screen, and validate that the text field does not contain special characters. For example, if you enter abc@, the custom validation method is called and an appropriate error message is displayed.

Before you begin

Understand how to add widgets to a screen.

Procedure

  1. Log on to Sterling™ Call Center. The Home page opens.
  2. open the Create Consumer screen in any of the following ways:
    • On the Home page, in the Customer panel click Create Consumer.
    • From Related Tasks, click Create Consumer.
  3. From the application header, click the Development Tools icon Customize the selected screen, and select Customize from the list. Hover over the Contact Information screen and right-click to select the screen.
    Alternatively, you can select Customize from Outline from the application header. The Select Screen to Extend window opens. From the tree, select CreateContact and click Extend Screen.
    Note:
    • If you cannot customize the selected screen, an appropriate message is displayed.
    • If multiple instances of the same screen are found, by default, the first instance of the screen is selected for customization.
  4. By default, the Layout tab is selected. From the Widget Palette panel, select and drag the Textbox widget to the Screen Outline panel and place the widget in the appropriate position. The Basic Properties window opens.
  5. In the Unique identifier field, select the extn_company_textfield.
  6. In Field label, click Select field label for the text widget. The Field label window opens.
  7. Click Add bundle entry for the text widget. The Add Bundle Entry window opens.
  8. In the Bundle Text field, enter Company name.
  9. In the Bundle key field, extn_company_name bundle key is populated.
  10. Click Ok.
  11. Click Select with Colon. The Basic Properties window opens.
  12. Click Apply.
  13. Click the Binding tab and expand Source.
  14. In the Namespace field, select getCustomerContact_output from the list.
  15. In the Path field, enter Customer.CustomerContactList.CustomerContact.Company.
  16. Expand Target, and in the Namespace field, select manageCustomer_input from the list.
  17. In the Path field, enter Customer.BuyerOrganization.CompanyName.
  18. Click the Events tab.
  19. Add the local onBlur event by clicking the Add iconAdd a handler. The Subscriber Details window opens.
  20. In the Method field, enter validateInput.
  21. Click Ok.
  22. Click the Others tab. Do the following steps:
    1. From the Available Properties list, select Max length and click Add.
    2. In the Max length field, enter the maximum number of characters that are allowed for the Company name field.
      For example, if you enter 10, the total number of characters that are allowed to be entered in the Company name field is restricted to 10 characters.
  23. Click Apply.
  24. Click Save. The createContactExtn.js file is generated.
  25. Click Close.

What to do next

  • Browse to <INSTALL_DIR>/extensions/isccs/webpages/customer/create, and open the createContactExtn.js file.
  • Add the following custom code to perform custom validation:
    validateInput : function(UIEvent,bEvent,control,args){	
    		var inputModel = _scScreenUtils.getTargetModel(
                    this, "manageCustomer_input", null);
    
    		var value = dLang.getObject("Customer.BuyerOrganization.CompanyName", false, inputModel);
        //dLang refers to Dojo class
    		var index= value.indexOf("@");
    
    		if(index!== -1){
    				_scWidgetUtils.markFieldinError(this,"extn_company_name","Input contains invalid characters",true);
    				return;
    
    		}
    	}
  • Import the appropriate utilities in scDefine.
  • Refresh or reload the screen to view the changes.