I want to add custom button near Cancel and Save button which should be visible when I click on create option.

I want to add custom button near Cancel and Save button which should be visible when I click on create option. 

I am able to add button on edit record as well as view record but not on create record.

Please help me here .

Sugar CRM version used : 10.3 Enterprise

Parents Reply Children
  • Hi    Please refer to attached screenshot. Button is added but the as you can see in the image below ,entire record view is disappeared. Please check the code below :

    /custom/modules/<module>/clients/base/views/create/create.php

    <?php
    $viewdefs['']['base']['view']['create']['panels'][0] = array(

    'name' => 'panel_header',
    'header' => true,
    'fields' => array(
    0 => array(
    'name' => 'picture',
    'type' => 'avatar',
    'width' => 42,
    'height' => 42,
    'dismiss_label' => true,
    'readonly' => true,
    ) ,
    1 => 'name',
    2 => array(
    'type' => 'rowaction',
    'event' => 'button:add_button:click',
    'name' => 'add_button',
    'label' => 'LBL_ADD_BUTTON_LABEL',
    'dismiss_label' => true,
    'css_class' => 'btn btn-primary',
    'acl_action' => 'view',
    ) ,
    ) ,
    );

  • Hi ,   I just watched the 11.1 release webinar and as mentioned above sugar will add custom button into studio....   you may want to wait for that?  Looks like it will much easier.

    See here: https://sugarclub.sugarcrm.com/dev-club/m/event-recaps/1634

    @ 0:31:41

  • Hi That's really good update to come but this is urgent for me .. if any solution or any alternate way to deal with this ,please let me know

  • Hi Gautam,

    try the below code in create.php

    <?php
    $viewdefs['Accounts'] =
    array (
    'base' =>
    array (
    'view' =>
    array (
    'create' =>
    array (
    'panels' =>
    array (
    0 =>
    array (
    'name' => 'panel_header',
    'header' => true,
    'fields' =>
    array (
    0 =>
    array (
    'name' => 'picture',
    'type' => 'avatar',
    'width' => 42,
    'height' => 42,
    'dismiss_label' => true,
    'readonly' => true,
    ),
    1 => 'name',
    2=>array(
    'type' => 'rowaction',
    'event' => 'button:validate_postal_code:click',
    'name' => 'validate',
    // 'label' => 'validate',
    'acl_action' => 'view',
    ),
    ),
    ),
    1 =>
    array (
    'name' => 'panel_body',
    'columns' => 2,
    'labelsOnTop' => true,
    'placeholders' => true,
    'fields' =>
    array (
    0 => 'website',
    1 => 'industry',
    2 => 'parent_name',
    3 => 'account_type',
    4 => 'assigned_user_name',
    5 => 'phone_office',
    ),
    ),
    2 =>
    array (
    'name' => 'panel_hidden',
    'hide' => true,
    'columns' => 2,
    'labelsOnTop' => true,
    'placeholders' => true,
    'fields' =>
    array (
    0 =>
    array (
    'name' => 'fieldset_address',
    'type' => 'fieldset',
    'css_class' => 'address',
    'label' => 'LBL_BILLING_ADDRESS',
    'fields' =>
    array (
    0 =>
    array (
    'name' => 'billing_address_street',
    'css_class' => 'address_street',
    'placeholder' => 'LBL_BILLING_ADDRESS_STREET',
    ),
    1 =>
    array (
    'name' => 'billing_address_city',
    'css_class' => 'address_city',
    'placeholder' => 'LBL_BILLING_ADDRESS_CITY',
    ),
    2 =>
    array (
    'name' => 'billing_address_state',
    'css_class' => 'address_state',
    'placeholder' => 'LBL_BILLING_ADDRESS_STATE',
    ),
    3 =>
    array (
    'name' => 'billing_address_postalcode',
    'css_class' => 'address_zip',
    'placeholder' => 'LBL_BILLING_ADDRESS_POSTALCODE',
    ),
    4 =>
    array (
    'name' => 'billing_address_country',
    'css_class' => 'address_country',
    'placeholder' => 'LBL_BILLING_ADDRESS_COUNTRY',
    ),
    ),
    ),
    1 =>
    array (
    'name' => 'fieldset_shipping_address',
    'type' => 'fieldset',
    'css_class' => 'address',
    'label' => 'LBL_SHIPPING_ADDRESS',
    'fields' =>
    array (
    0 =>
    array (
    'name' => 'shipping_address_street',
    'css_class' => 'address_street',
    'placeholder' => 'LBL_SHIPPING_ADDRESS_STREET',
    ),
    1 =>
    array (
    'name' => 'shipping_address_city',
    'css_class' => 'address_city',
    'placeholder' => 'LBL_SHIPPING_ADDRESS_CITY',
    ),
    2 =>
    array (
    'name' => 'shipping_address_state',
    'css_class' => 'address_state',
    'placeholder' => 'LBL_SHIPPING_ADDRESS_STATE',
    ),
    3 =>
    array (
    'name' => 'shipping_address_postalcode',
    'css_class' => 'address_zip',
    'placeholder' => 'LBL_SHIPPING_ADDRESS_POSTALCODE',
    ),
    4 =>
    array (
    'name' => 'shipping_address_country',
    'css_class' => 'address_country',
    'placeholder' => 'LBL_SHIPPING_ADDRESS_COUNTRY',
    ),
    5 =>
    array (
    'name' => 'copy',
    'label' => 'NTC_COPY_BILLING_ADDRESS',
    'type' => 'copy',
    'mapping' =>
    array (
    'billing_address_street' => 'shipping_address_street',
    'billing_address_city' => 'shipping_address_city',
    'billing_address_state' => 'shipping_address_state',
    'billing_address_postalcode' => 'shipping_address_postalcode',
    'billing_address_country' => 'shipping_address_country',
    ),
    ),
    ),
    ),
    2 =>
    array (
    'name' => 'phone_alternate',
    'label' => 'LBL_OTHER_PHONE',
    ),
    3 => 'email',
    4 => 'phone_fax',
    5 => 'campaign_name',
    6 =>
    array (
    'name' => 'description',
    'span' => 12,
    ),
    7 => 'sic_code',
    8 => 'ticker_symbol',
    9 => 'annual_revenue',
    10 => 'employees',
    11 => 'ownership',
    12 => 'rating',
    13 =>
    array (
    'name' => 'date_entered_by',
    'readonly' => true,
    'type' => 'fieldset',
    'label' => 'LBL_DATE_ENTERED',
    'fields' =>
    array (
    0 =>
    array (
    'name' => 'date_entered',
    ),
    1 =>
    array (
    'type' => 'label',
    'default_value' => 'LBL_BY',
    ),
    2 =>
    array (
    'name' => 'created_by_name',
    ),
    ),
    ),
    14 => 'team_name',
    15 =>
    array (
    'name' => 'date_modified_by',
    'readonly' => true,
    'type' => 'fieldset',
    'label' => 'LBL_DATE_MODIFIED',
    'fields' =>
    array (
    0 =>
    array (
    'name' => 'date_modified',
    ),
    1 =>
    array (
    'type' => 'label',
    'default_value' => 'LBL_BY',
    ),
    2 =>
    array (
    'name' => 'modified_by_name',
    ),
    ),
    'span' => 12,
    ),
    ),
    ),
    ),
    'templateMeta' =>
    array (
    'useTabs' => false,
    'tabDefs' =>
    array (
    'LBL_RECORD_BODY' =>
    array (
    'newTab' => false,
    'panelDefault' => 'expanded',
    ),
    'LBL_RECORD_SHOWMORE' =>
    array (
    'newTab' => false,
    'panelDefault' => 'expanded',
    ),
    ),
    ),
    ),
    ),
    ),
    );
  • Thank you .. It was done .. I missed to provide panel body in the code... 

    Alignment is not correct ..any idea regarding that ? button should come just before Cancel button.

  • seems like they integrate wButtons by Sugar-acquired W-Systems into OOTB Sugar - good news!

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient

  • To follow up on 's comment, Action Buttons are now available as of the Q3 2021 release, developed from the wTools Custom Buttons package. You can read more about Action Buttons in the Sugar Product Guide and we also have a comparison of the two offerings in the Help Article, Understanding Action Buttons vs wTools Custom Buttons.