My steps:
1. Create array in the record.php like this
5 => array ('type' => 'rowaction',
'event' => 'button:create_data_po:click',
'name' => 'create_data_po',
'label' => 'LBL_CREATE_DATA_PO_C',
'acl_action' => 'view'),
2. Create lng-file (en_us.addContactsActionLink.php):
<?php $mod_strings['LBL_CREATE_DATA_PO_C'] = 'Crate Data PO';
3. Create record.js file:
({
extendsFrom: 'RecordView',
zipJSON: {},
initialize: function (options) {
app.view.invokeParent(this, {type: 'view', name: 'record', method: 'initialize', args:[options]});
this.context.on('button:create_data_po:click', this.create_data_po, this);
},
create_data_po: function() {
var ContID = this.model.get('id');
$('a[name=create_data_po]').attr('target', '_blank');
$('a[name=create_data_po]').attr('href', 'http://**************************?id='+ContID);
window.open($('a[name=create_data_po]').attr('href'));
}
})
4. Create manifest.php (for uploading all this files):
<?php
$manifest = array(
'acceptable_sugar_flavors' => array('CE','PRO','CORP','ENT','ULT'),
'acceptable_sugar_versions' => array('exact_matches' => array(),
'regex_matches' => array('(.*?)\\.(.*?)\\.(.*?)$')),
'author' => 'Nick Gamora',
'description' => 'Adding Contacts menu action Links',
'icon' => '',
'is_uninstallable' => true,
'name' => 'addContactsActionLink',
'published_date' => '2016-08-17 2016 15:28:04',
'type' => 'module',
'version' => '1',
);
$installdefs = array(
'id' => 'Adding',
'copy' => array(
0 => array(
'from' => '<basepath>/record.php',
'to' => 'custom/modules/Contacts/clients/base/views/record/record.php',
),
1 => array(
'from' => '<basepath>/en_us.addContactsActionLink.php',
'to' => 'custom/Extension/modules/Contacts/Ext/Language/en_us.addContactsActionLink.php',
),
2 => array(
'from' => '<basepath>/record.js',
'to' => 'custom/modules/Contacts/clients/base/views/record/record.js ',
),
),
);
?>
But after upload and repair & rebuild I can not see that js file works. I see link was added, but both consle.log and alert do not work.
Does anybody know how to do it correct?
I need my url open in the new tab after I click the button ('Crate Data PO').