How show phone_mobile of contacs in create view of Call Module? Sugar 7.6

How show phone_mobile of contacs in create view of Call Module?

I'm add calculated value in field related($contacts, "phone_mobile"), but this show phone_mobile only record View.

How show in create view?

  • When using Sugar logic the field is specified as 'read-only' because the logic is enforced.

    You could disable the enforce on the field.

    $dictionary['Call']['fields']['phone_mobile']['enforce']='false'
    

    When creating a new Call from the contact's subpanel the phone_mobile will be autofilled. The field remains editable.

  • I'm create file

    custom/modules/Calls/Ext/Vardefs/vardefs.ext.php

    and

    add line

    $dictionary['Call']['fields']['phone_mobile']['enforce']='false'  
    
    

    But, this not work for me

    Thank you

    1. The contents of a file in the folder custom/modules/Calls/Ext/Vardefs/vardefs.ext.php get lost after a repair & rebuild.
    2. You could add the line of code to the file containing the definition of the field custom/Extension/modules/Calls/Ext/Vardefs/<fieldname>.php. After editing the field in the studio the enforced=false change will undone.

    The best solution is to add a file called enforce.php in de folder custom/Extension/modules/Calls/Ext/Vardefs containing:

    <?php

    $dictionary['Call']['fields']['phone_mobile']['enforce']='false'

    ?>

    replace the name "phone_mobile" with the fieldname you are using in the Call module to store the contacts phone_mobile. (probably ending with a _c)

    Don't forget to Repair & Rebuild

  • Thank you for help, but this soluction not work for me.

    1 - My field name is: custom_mobile_c

    2 - My Formula in Calculated Value is: related($contacts,"phone_work")

    3 - I'm add custom/modules/Calls/Ext/Vardefs/enforce.php with code:

    <?php

    $dictionary['Call']['fields']['custom_mobile_c']['enforce'] = 'false';

    ?>

    But not work in sugarcrm 7.6

     

  • 4. Admin -> Repair & Rebuild ?

    Also check file permissions/owner. The enforced.php should have the same permissions/owner as the other files.

    (I'm using 7.6.1.0)

  • I'm use Repair & Rebuild, but not work.

    How check file permissions in sugarcrm ondemand. This possible?

    Thank you.

  • In On-demand it's not possible. (How did you get the file in the correct place? using a package)

    I'm on an on-premise environment. Not sure how on-demand works.

  • Thank you for help.

    I'm solved with code:

    Event:

    this.model.on('change:parent_name', this.updatePhoneNumbers, this);

    Function:

    updatePhoneNumbers: function() {

            var mobile = 0;

            var work = 0; 

            var obj = this;

            if(this.model.get('parent_type') == 'Contacts' || this.model.get('parent_type') == 'Leads' || this.model.get('parent_type') == 'Prospects')

              var leadId=this.model.get('parent_id'); 

              app.data.createBean(this.model.get('parent_type'),{id:leadId}).fetch({        

                      success:function(lead){ 

                          mobile = lead.get('phone_mobile'); 

                          work = lead.get('phone_work');   

                          obj.model.set('lftm_celular_contato_c', mobile); 

                          obj.model.set('lftm_telefone_contato_c', work);     

                      } 

              });

            }

            else{

              obj.model.set('lftm_celular_contato_c', ''); 

              obj.model.set('lftm_telefone_contato_c', ''); 

            }

        }

    It's work.