AnsweredAssumed Answered

How to use save and view,save and create new in create.js in sugar version 7.7.1.1

Question asked by sidhu sidhu on Sep 9, 2016
Latest reply on Sep 9, 2016 by Mehul Bhandari

create.php

<?php
/*
 * Your installation or use of this SugarCRM file is subject to the applicable
 * terms available at
 * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
 * If you do not agree to all of the applicable terms or do not have the
 * authority to bind the entity as an authorized representative, then do not
 * install or use this SugarCRM file.
 *
 * Copyright (C) SugarCRM Inc. All rights reserved.
 */
$viewdefs['Calls']['base']['view']['create'] = array(
    'template' => 'record',
    'buttons' => array(
        array(
            'name' => 'cancel_button',
            'type' => 'button',
            'label' => 'LBL_CANCEL_BUTTON_LABEL',
            'css_class' => 'btn-invisible btn-link',
            'events' => array(
                'click' => 'button:cancel_button:click',
            ),
        ),
        array(
            'name' => 'restore_button',
            'type' => 'button',
            'label' => 'LBL_RESTORE',
            'css_class' => 'btn-invisible btn-link',
            'showOn' => 'select',
            'events' => array(
                'click' => 'button:restore_button:click',
            ),
        ),
        array(
            'type' => 'actiondropdown',
            'name' => 'main_dropdown',
            'primary' => true,
            'switch_on_click' => true,
            'showOn' => 'create',
            'buttons' => array(
                array(
                    'type' => 'rowaction',
                    'name' => 'save_button',
                    'label' => 'LBL_SAVE_BUTTON_LABEL',
                    'events' => array(
                        'click' => 'button:save_button:click',
                    ),
                ),
                array(
                    'type' => 'save-and-send-invites-button',
                    'name' => 'save_invite_button',
                    'label' => 'LBL_SAVE_AND_SEND_INVITES_BUTTON',
                    'events' => array(
                        'click' => 'button:save_button:click',
                    ),
                ),
       
                
                  array(
                    'type' => 'rowaction',
                    'name' => 'save_view_button',//mybutton
                    'label' => 'LBL_SAVE_AND_VIEW',
                    'events' => array(
                        'click' => 'button:save_view_button:click',
                    ),
                ),
                array(
                    'type' => 'rowaction',
                    'name' => 'save_create_button',//mybutton
                    'label' => 'LBL_SAVE_AND_CREATE_ANOTHER',
                    'events' => array(
                        'click' => 'button:save_create_button:click',
                    ),
                ),
              
            ),
        ),
        array(
            'name' => 'duplicate_button',
            'type' => 'button',
            'label' => 'LBL_IGNORE_DUPLICATE_AND_SAVE',
            'primary' => true,
            'showOn' => 'duplicate',
            'events' => array(
                'click' => 'button:save_button:click',
            ),
        ),
        array(
            'name' => 'select_button',
            'type' => 'button',
            'label' => 'LBL_SAVE_BUTTON_LABEL',
            'primary' => true,
            'showOn' => 'select',
            'events' => array(
                'click' => 'button:save_button:click',
            ),
        ),
        array(
            'name' => 'sidebar_toggle',
            'type' => 'sidebartoggle',
        ),
    ),
);

 

 

create.js

({
    extendsFrom: 'CreateView',

 

    /**
     * @inheritdoc
     */
    initialize: function(options) {
        this.plugins = _.union(this.plugins || [], ['AddAsInvitee', 'ReminderTimeDefaults']);
        this._super('initialize', [options]);
       this.events['click [name=save_view_button]'] = 'save_view_button';
        this.events['click [name=save_create_button]'] = 'save_create_button';
    },
  

save_view_button:function()

{

 

alert("save_view_button");//how to user here for save view

 

},
    
   save_create_button:function()
    {
        
         alert("save_create_button"); //how to use here save_create_button
        
    },

 

   
})

 

Tevfik Tümer Shijin Krishna Avinash Singh Ramana Raju Santhana

Outcomes