customization in create lead form

I want to customize  create lead form.

I have added a check box on the bottom of Primary Address.

then my task is:-

If that check box is enable then Alternate Address  is show otherwise Alternate Address is hidden.

I am not able to get the file in which file i have to change . Please suggest me.

Parents
  • Hi Kushank Jain

    You should do it in create-actions.js. The path should be something like /custom/modules/Leads/clients/base/views/create-actions/

    this.model.on('change:name_of_checkbox', this.name_function_with_functionality, this);
    

    Hope it helps

  • Hi Gerardo Garcia Lima,

    in this path /custom/modules/Leads/clients/base/views

    i have found only list and record folder and in both folder nothing create-actions.js

  • Hello kushank jain,

    As Gerardo suggested, you need to create folder as create-actions in /custom/modules/Leads/clients/base/view/

    path will look like below

    /custom/modules/Leads/clients/base/view/create-actions

    Then create new file as create-actions.js

    Here you need to extend view from CreateView,

    So now our file will be look like

    {(
       extendsFrom:'CreateView',
       initialize:function (options) {
            this._super('initialize', [options]);
            this.model.on('change:name_of_checkbox', this.name_function_with_functionality, this);
      },
       name_function_with_functionality:function(){
         //your custom code 
       },
    })
    
    

    Give repair and rebuild.

    Note: In sugar7.7,there will not be create-actions.js For your reference

    CreateActionsView changes in Sugar 7.7.0 « Sugar Developer Blog – SugarCRM

    So Its better to have create folder and create.js in the same path,It will look like

    /custom/modules/Leads/clients/base/view/create/create.js

    and paste the above code here too

    Thanks!.

  • hi,

    now i am able to hide on click of checkbox. but my requirement is to hide initially and on click of checkbox alternate address will show.

    ({

           extendsFrom:'CreateView', 

           initialize:function (options) { 

                this._super('initialize', [options])

                 this.model.on("render", this.updateh1Css, this);

    this.model.on('change:add_alternate_address_c', this.checkAddress, this); 

          }, 

         updateh1Css :function(){

         console.log("this is call");

        

            $('[data-name=alt_address]').hide();

         },

           checkAddress:function(){ 

             //your custom code  

             console.log("this is checkAddress");

            $('[data-name=alt_address]').show();

             }, 

        }) 

Reply
  • hi,

    now i am able to hide on click of checkbox. but my requirement is to hide initially and on click of checkbox alternate address will show.

    ({

           extendsFrom:'CreateView', 

           initialize:function (options) { 

                this._super('initialize', [options])

                 this.model.on("render", this.updateh1Css, this);

    this.model.on('change:add_alternate_address_c', this.checkAddress, this); 

          }, 

         updateh1Css :function(){

         console.log("this is call");

        

            $('[data-name=alt_address]').hide();

         },

           checkAddress:function(){ 

             //your custom code  

             console.log("this is checkAddress");

            $('[data-name=alt_address]').show();

             }, 

        }) 

Children