41 Making Notes Field Mandatory

Learn how to make the Notes field mandatory for additional product purchase and event adjustments in Oracle Communications Billing Care.

Topics in this document:

Making Notes Mandatory for Additional Product Purchase

You can use the Billing Care SDK to make the Notes field mandatory on the Purchase Add on Deal Confirmation screen.

To make the Notes field mandatory:

  1. Create a custom view model to override the default view of the Purchase Add on Deal Confirmation screen. See "Creating a Custom Purchase Deal View Model" for more information.

  2. Create a customRegistry.js file to configure Billing Care to use the custom view model that you created. See "Configuring the Custom Purchase View Model in the Registry" for more information.

  3. Deploy your customizations using one of the methods described in "Using an Exploded Archive during Customization" or "Packaging and Deploying Customizations".

Creating a Custom Purchase Deal View Model

Billing Care uses view model to define the display of the screens in Billing Care. You must create or update the custom view model, CustomPurchaseViewModel, and add the details containing the logic to make the Notes field mandatory.

See "About View Models" for more information about Billing Care view models.

To create a custom purchase deal view model:

  1. Create or update the CustomPurchaseViewModel.js file in myproject/web/custom/viewmodels directory, where myproject is the folder containing your NetBeans IDE project.
  2. Add the following code in the CustomPurchaseViewModel.js file using a text editor:
    define(['jquery', 'knockout', 
    'viewmodels/purchase/PurchaseConfigurationViewModel'], 
            function ($, ko, PurchaseConfigurationViewModel) { 
    
                function customPurchaseViewModel() { 
                    PurchaseConfigurationViewModel.apply(this, arguments); 
                    self = this; 
                     
                    self.isValid = function () { 
                         $("#enterNotesTextArea").attr('name', 
    'enterNotesWithoutReason'); 
                        if (self.note.isValid() && self.note.validator && 
    self.note.validator.form() && self.note.comments.comment() ) { 
                            return true; 
                        } 
                        return false; 
                    }; 
    
                } 
                customPurchaseViewModel.prototype = new 
    PurchaseConfigurationViewModel(); 
                return  customPurchaseViewModel; 
            }); 
  3. Save the file in your NetBeans IDE project.

Configuring the Custom Purchase View Model in the Registry

After creating the required custom view model, create a custom purchase view model entry in the customRegistry.js file. Billing Care uses the custom purchase view model instead of the default view model during additional product purchase and renders the Purchase Add on Deal Confirmation screen containing your customization.

To create the custom purchase view model entry in the registry:

  1. Create a customRegistry.js file in myproject/web/custom/ directory.

  2. Define the custom purchase module in this file. For example:

    purchaseConfiguration: { 
       viewmodel: 'custom/viewmodels/customPurchaseViewModel.js' 
    } 
  3. Save the file in your NetBeans IDE project.

Making Notes Mandatory for Event Adjustments

You can use the Billing Care SDK to make the Notes field mandatory in the Event Adjustment dialog box.

To make the Notes field mandatory:

  1. Create a custom view model to override the default view of the Event Adjustment dialog box. See "Creating a Custom Event Adjustment View Model" for more information.
  2. Create a customRegistry.js file to configure Billing Care to use the custom view model that you created. See "Configuring the Custom Event Adjustment View Model in the Registry" for more information.
  3. Deploy your customizations using one of the methods described in "Using an Exploded Archive during Customization" or "Packaging and Deploying Customizations".

Creating a Custom Event Adjustment View Model

Billing Care uses view models to define the display of its screens. You must create or update the custom view model, CustomEventAdjustmentViewModel, and add the details containing the logic to make the Notes field mandatory.

See "About View Models" for more information about Billing Care view models.

To create a custom purchase deal view model:

  1. Create or update the customEventAdjustmentViewModel.js file in the myproject/web/custom/viewmodels directory, where myproject is the folder containing your NetBeans IDE project.
  2. Add the following code in the customEventAdjustmentViewModel.js file using a text editor:
    define(['jquery', 'knockout', 
        'viewmodels/ARActions/adjustments/EventAdjustmentViewModel' 
    ], 
            function($, ko, EventAdjustmentViewModel) { 
    
                function customEventAdjustmentViewModel() { 
                    EventAdjustmentViewModel.apply(this, arguments); 
                    self = this; 
                    self.isValid = function() { 
    
         /** 
         * Here "if(isGranted)" condition is added for authorization. 
         * create customAction in resource and use it in below function 
         * util.isGrantedResourceAction("customAction", "NoteResource"); 
         * 
         * Use below line directly without "if(isGranted)" condition if OPSS enforcement is not needed 
         * $("#enterNotesTextArea").attr('name', 'enterNotesWithoutReason'); 
         * 
         */ 
    
    
                       var isGranted = util.isGrantedResourceAction("customAction", "NoteResource"); 
                       if (isGranted) { 
                          $("#enterNotesTextArea").attr('name', 'enterNotesWithoutReason'); 
                       } 
                       if (self.note.isValid() && self.validator && 
                          self.validator.form()) { 
                             return true; 
                          } 
                        return false; 
                    };  
                } 
                customEventAdjustmentViewModel.prototype = new EventAdjustmentViewModel(); 
                return  customEventAdjustmentViewModel; 
            }); 
  3. Save the file in your NetBeans IDE project.

Configuring the Custom Event Adjustment View Model in the Registry

After creating the required custom view model, create a custom event adjustment model entry in the customRegistry.js file. Billing Care uses the custom event adjustment view model instead of the default event adjustment view model during adjustments and renders the Event Adjustment dialog box containing your customization.

To create the custom event adjustment view model entry in the registry:

  1. Create a customRegistry.js file in the myproject/web/custom/ directory.
  2. Define the custom event adjustment module in this file. For example:
    eventAdjustment: { 
       viewmodel: 'custom/viewmodels/customEventAdjustmentViewModel.js' 
    } 
  3. Save the file in your NetBeans IDE project.