AnsweredAssumed Answered

How To Copy Lead Module Name Field values to the Opportunity Module Name Field in the Lead Conversion Page.

Question asked by Sanchit Kumar Singh on Nov 30, 2018
Latest reply on Dec 3, 2018 by Francesca Shiekh

 

Hi

I Need to Create Contact Module Type Name Field with (salutation,firstname.lastname) in the Opportunity Module.After that I need to copy the Lead name Into the Opportunity Module Name field in the Lead conversion Page .I have created the Name field in Opportunity Module with the fullname.js,record.php,list.php files.The Name Field is working Properly in the Opportunity Module.But I am getting the Error in Lead Conversion Page that is,After the field mapping of Name From the Lead to Opportunity I tried to create the Opportunity record but while clicking the create button It showing error message.If I enter any single value manually in the salutation,firstname,lastname and tried to create record the record is created.I don't know why this Error is happening I am new to SugarCRM Can anyone please give Assistance.

 

These are My Files 

fullname.js (path:custom/modules/Opportunities/clients/base/fields/fullname/fullname.js)

({
extendsFrom: 'FullnameField',

formatMap: {

's': 'salutation_c',
'f': 'first_name_c',
'l': 'last_name_c'

},

initialize: function(options) {
// override the name format for this module
app.user.setPreference('default_locale_name_format', 's f l');

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

format: function() {
var fullname = this.model.attributes.salutation_c +' '+ this.model.attributes.first_name_c +' ';

fullname += this.model.attributes.last_name_c;

return fullname;
},
})

 

record.php

<?php
$viewdefs['Opportunities'] =
array (
'base' =>
array (
'view' =>
array (
'record' =>
array (
'buttons' =>
array (
0 =>
array (
'type' => 'button',
'name' => 'cancel_button',
'label' => 'LBL_CANCEL_BUTTON_LABEL',
'css_class' => 'btn-invisible btn-link',
'showOn' => 'edit',
'events' =>
array (
'click' => 'button:cancel_button:click',
),
),
1 =>
array (
'type' => 'rowaction',
'event' => 'button:save_button:click',
'name' => 'save_button',
'label' => 'LBL_SAVE_BUTTON_LABEL',
'css_class' => 'btn btn-primary',
'showOn' => 'edit',
'acl_action' => 'edit',
),
2 =>
array (
'type' => 'actiondropdown',
'name' => 'main_dropdown',
'primary' => true,
'showOn' => 'view',
'buttons' =>
array (
0 =>
array (
'type' => 'rowaction',
'event' => 'button:edit_button:click',
'name' => 'edit_button',
'label' => 'LBL_EDIT_BUTTON_LABEL',
'acl_action' => 'edit',
),
1 =>
array (
'type' => 'shareaction',
'name' => 'share',
'label' => 'LBL_RECORD_SHARE_BUTTON',
'acl_action' => 'view',
),
2 =>
array (
'type' => 'pdfaction',
'name' => 'download-pdf',
'label' => 'LBL_PDF_VIEW',
'action' => 'download',
'acl_action' => 'view',
),
3 =>
array (
'type' => 'pdfaction',
'name' => 'email-pdf',
'label' => 'LBL_PDF_EMAIL',
'action' => 'email',
'acl_action' => 'view',
),
4 =>
array (
'type' => 'divider',
),
5 =>
array (
'type' => 'rowaction',
'event' => 'button:find_duplicates_button:click',
'name' => 'find_duplicates_button',
'label' => 'LBL_DUP_MERGE',
'acl_action' => 'edit',
),
6 =>
array (
'type' => 'rowaction',
'event' => 'button:duplicate_button:click',
'name' => 'duplicate_button',
'label' => 'LBL_DUPLICATE_BUTTON_LABEL',
'acl_module' => 'Opportunities',
'acl_action' => 'create',
),
7 =>
array (
'type' => 'rowaction',
'event' => 'button:historical_summary_button:click',
'name' => 'historical_summary_button',
'label' => 'LBL_HISTORICAL_SUMMARY',
'acl_action' => 'view',
),
8 =>
array (
'type' => 'rowaction',
'event' => 'button:audit_button:click',
'name' => 'audit_button',
'label' => 'LNK_VIEW_CHANGE_LOG',
'acl_action' => 'view',
),
9 =>
array (
'type' => 'divider',
),
10 =>
array (
'type' => 'rowaction',
'event' => 'button:delete_button:click',
'name' => 'delete_button',
'label' => 'LBL_DELETE_BUTTON_LABEL',
'acl_action' => 'delete',
),
),
),
3 =>
array (
'name' => 'sidebar_toggle',
'type' => 'sidebartoggle',
),
),
'panels' =>
array (
0 =>
array (
'name' => 'panel_header',
'header' => true,
'fields' =>
array (
0 =>
array (
'name' => 'picture',
'type' => 'avatar',
'size' => 'large',
'dismiss_label' => true,
'readonly' => true,
),
1 =>
array (
'name' => 'name',
'label' => 'LBL_NAME',
'dismiss_label' => true,
'type' => 'fullname',
'fields' =>
array (
0 => 'salutation_c',
1 => 'first_name_c',
2 => 'last_name_c',
),
),
//~ array (
//~ 'name' => 'name',
//~ 'related_fields' =>
//~ array (
//~ 0 => 'total_revenue_line_items',
//~ 1 => 'closed_revenue_line_items',
//~ 2 => 'included_revenue_line_items',
//~ ),
//~ ),
2 =>
array (
'name' => 'favorite',
'label' => 'LBL_FAVORITE',
'type' => 'favorite',
'dismiss_label' => true,
),
3 =>
array (
'name' => 'follow',
'label' => 'LBL_FOLLOW',
'type' => 'follow',
'readonly' => true,
'dismiss_label' => true,
),
),
),
1 =>
array (
'name' => 'panel_body',
'label' => 'LBL_RECORD_BODY',
'columns' => 2,
'labels' => true,
'labelsOnTop' => true,
'placeholders' => true,
'newTab' => true,
'panelDefault' => 'expanded',
'fields' =>
array (
0 =>
array (
'name' => 'application_id_c',
'label' => 'LBL_APPLICATION_ID',
),
1 =>
array (
'name' => 'sales_stage_c',
'label' => 'LBL_SALES_STAGE_C',
),
2 =>
array (
'name' => 'first_name_c',
'label' => 'LBL_FIRST_NAME',
),
3 =>
array (
'name' => 'last_name_c',
'label' => 'LBL_LAST_NAME',
),
4 =>
array (
'name' => 'lead_id_c',
'label' => 'LBL_LEAD_ID_C',
),
5 =>
array (
'name' => 'leads_opportunities_1_name',
),
6 =>
array (
'name' => 'student_id_c',
'label' => 'LBL_STUDENT_ID',
),
7 =>
array (
'name' => 'stu_students_opportunities_1_name',
),
8 =>
array (
'name' => 'mobile_c',
'label' => 'LBL_MOBILE',
),
9 =>
array (
'name' => 'email_c',
'label' => 'LBL_EMAIL',
),
10 =>
array (
'name' => 'gender_c',
'label' => 'LBL_GENDER',
),
11 =>
array (
),
12 =>
array (
'name' => 'birthdate_c',
'label' => 'LBL_BIRTHDATE',
),
13 =>
array (
'name' => 'year_of_birth_c',
'label' => 'LBL_YEAR_OF_BIRTH',
),
14 =>
array (
'name' => 'country_of_residence_c',
'label' => 'LBL_COUNTRY_OF_RESIDENCE',
),
15 =>
array (
'name' => 'destination_country_c',
'label' => 'LBL_DESTINATION_COUNTRY',
),
16 =>
array (
'name' => 'address_c',
'label' => 'LBL_ADDRESS',
),
17 =>
array (
'name' => 'state_c',
'label' => 'LBL_STATE',
),
18 =>
array (
'name' => 'city_c',
'label' => 'LBL_CITY',
),
19 =>
array (
'name' => 'postal_code_c',
'label' => 'LBL_POSTAL_CODE',
),
20 =>
array (
'name' => 'account_name',
'related_fields' =>
array (
0 => 'account_id',
),
),
21 =>
array (
),
),
),
2 =>
array (
'newTab' => true,
'panelDefault' => 'expanded',
'name' => 'LBL_RECORDVIEW_PANEL2',
'label' => 'LBL_RECORDVIEW_PANEL2',
'columns' => 2,
'labelsOnTop' => 1,
'placeholders' => 1,
'fields' =>
array (
0 => 'campaign_name',
1 => 'lead_source',
),
),
3 =>
array (
'newTab' => true,
'panelDefault' => 'expanded',
'name' => 'LBL_RECORDVIEW_PANEL1',
'label' => 'LBL_RECORDVIEW_PANEL1',
'columns' => 2,
'labelsOnTop' => 1,
'placeholders' => 1,
'fields' =>
array (
0 =>
array (
'name' => 'partner_id_c',
'label' => 'LBL_PARTNER_ID',
),
1 =>
array (
'name' => 'part_partners_opportunities_2_name',
),
),
),
4 =>
array (
'name' => 'panel_hidden',
'label' => 'LBL_RECORD_SHOWMORE',
'hide' => true,
'labelsOnTop' => true,
'placeholders' => true,
'columns' => 2,
'newTab' => true,
'panelDefault' => 'expanded',
'fields' =>
array (
0 =>
array (
'name' => 'producttemplates_opportunities_1_name',
),
1 =>
array (
),
2 => 'assigned_user_name',
3 => 'team_name',
4 =>
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',
),
),
),
5 =>
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',
),
),
),
),
),
),
'templateMeta' =>
array (
'useTabs' => true,
),
),
),
),
);

 

This My Error In Lead Conversion Page While I create the Opportunity Record

 

 

Outcomes