Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
extend the modules/Leads/clients/base/layouts/convert-main.php layout via the Extension Framework
//File: /custom/Extension/modules/Leads/Ext/clients/base/layouts/convert-main/mapNewFields.php
//One Gotcha with this, this file will be required
//when metadata is being rebuilt and so you must avoid defining the following
//variable names here: $module and $type
//Doing so will override those variables in the MetaDatFiles parser and cause
//un-expected results.
//The $customMapping array contains the extra set of fields, for each module, that
//should be mapped with values from the source Lead record
//For example, in the mapping below, we have extra mappings for each of the Modules
//involved in the Lead conversion process. The Keys of the $customMapping must be the module
//Name that corresponds to one of the defined Modules in the Layout definition. Each module entry
//contains the mappings for that module. The key (left-hand side) corresponds to the module field and
//the value (right-hand side) is the Lead field, whose value should be mapped to the module field.
$customMapping = [
//Contacts module field as key and Lead field as value
"Contacts" => [
"department" => "new_cstm_field_c",
"Accounts" => [
//Accounts module field as key and Lead field as value
"new_acct_field_1_c" => "new_cstm_field_c",
"description" => "website",
"Opportunities" => [
//Opportunities module field as key and Lead field as value
"description" => "new_cstm_field_c",
foreach ($viewdefs['Leads']['base']['layout']['convert-main']['modules'] as $moduleIndex => $moduleEntry) {
//Look into custom mapping array for a Key matching the module name being iterated over
//in the LayoutDef
if (!empty($customMapping[$moduleEntry["module"]])) {
foreach ($customMapping[$moduleEntry["module"]] as $destFieldName => $sourceLeadFieldName) {
$viewdefs['Leads']['base']['layout']['convert-main']['modules'][$moduleIndex]['fieldMapping'][$destFieldName] =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.