Steps to add Account field (related Module) in Campaign Module
1. Insert value in vtiger_relatedlists table
CODE
insert into vtiger_relatedlists(relation_id,tabid, related_tabid, name, sequence, label, presence)values(83,26,6,'get_accounts',10,'Accounts',0);
2. Create New table (i.e. vtiger_campaignaccountrel) to maintain relation
CODE
CREATE TABLE `vtiger_campaignaccountrel` (
`campaignid` int(19) NOT NULL default '0',
`accountid` int(19) NOT NULL default '0',
PRIMARY KEY (`campaignid`,`accountid`),
KEY `vtiger_campaignaccountrel_accountid_idx` (`accountid`),
CONSTRAINT `fk_2_vtiger_vtiger_campaignaccountrel` FOREIGN KEY (`accountid`)
REFERENCES `vtiger_account` (`accountid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8
`campaignid` int(19) NOT NULL default '0',
`accountid` int(19) NOT NULL default '0',
PRIMARY KEY (`campaignid`,`accountid`),
KEY `vtiger_campaignaccountrel_accountid_idx` (`accountid`),
CONSTRAINT `fk_2_vtiger_vtiger_campaignaccountrel` FOREIGN KEY (`accountid`)
REFERENCES `vtiger_account` (`accountid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8
3. To get campaign related accounts, define a function(get_accounts) like get_contacts/get_leads in modules/Campaigns/Campaigns.php
4. To display related accounts in campaign's related list, do the required changes in Smarty/templates/RelatedListContents.tpl
CODE
{elseif $MODULE eq 'Campaigns'}
<input alt="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Account}" title="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Account}" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Account}" LANGUAGE=javascript onclick='return window.open("index.php?module=Accounts&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}&parenttab={$CATEGORY}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button" name="button">
<input alt="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Account}" title="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Account}" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Account}" LANGUAGE=javascript onclick='return window.open("index.php?module=Accounts&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}&parenttab={$CATEGORY}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button" name="button">

