Cases do work this way in some manner since they are tied to contacts (see subpanels). It's not exactly like Accounts where a case is tied to directly one account but you can add multiple contacts to a case. If you want to add a contact to a case when adding a new case instead of saving then adding using the subpanel you can make some small changes to do that. It'll then save the contact in the subpanel contact list though which should be sufficient for what you need. Basically it's a way to set a primary contact immediately when creating the case.
In modules\Cases\EditView.php add this could before the INBOUND EMAIL HANDLING area:
PHP Code:
/** eggsurplus: added contact popup for new case */
if( (!isset($focus->id) || $focus->new_with_id ) && !isset($focus->contact_id)) {
//contact popup...show only if new record to more quickly associate a contact to a case
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'contact_id',
'name' => 'contact_name',
),
);
$encoded_contact_popup_request_data = $json->encode($popup_request_data);
$contact_popup = " <td class='dataLabel'><span sugar='slot90'>Primary Contact:</span sugar='slot'></td> "
." <td class='dataField'><span sugar='slot90b'> "
." <input tabindex='2' readonly id='contact_name' name='contact_name' type='text' value=''> "
." <input id='contact_id' name='contact_id' type='hidden' value='' /> "
." <input title='".$app_strings['LBL_SELECT_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_SELECT_BUTTON_KEY']."' type='button' tabindex='2' class='button' value='".$app_strings['LBL_SELECT_BUTTON_LABEL']."' name=btn1 "
." onclick='open_popup(\"Contacts\", 600, 400, \"\", true, false, ".$encoded_contact_popup_request_data.");' /></span sugar='slot'></td> ";
} else {
$contact_popup = " <td class='dataLabel'><span sugar='slot98'> </span sugar='slot'></td> "
." <td class='dataField'><span sugar='slot99'> </span sugar='slot'></td> ";
}
$xtpl->assign('CONTACT_POPUP', $contact_popup);
/** end eggsurplus custom */
In modules\Cases\EditView.html add {CONTACT_POPUP} somewhere in the place of the two td cells where you would like it to go (see bottom of this code block):
PHP Code:
<tr valign="top">
<td class="dataLabel" valign="top"><span sugar='slot9'>{MOD.LBL_DATE_START_TIME} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></span sugar='slot'></td>
<td class="dataField"><span sugar='slot9b'>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td nowrap="nowrap"><input name="date_start" onblur="parseDate(this, '{CALENDAR_DATEFORMAT}');" id="date_start_field" tabindex="1"
size="11" maxlength="10" type="text" value="{date_start}" />
<img src="themes/{THEME}/images/jscalendar.gif" alt="{MOD.LBL_DATE_START_TIME}"
id="date_start_picker" align="absmiddle" /> </td>
<td nowrap="nowrap"><input name="time_start" id="time_start" tabindex="1" size="5"
maxlength="5" type="text" value="{time_start}" />{time_start_meridian} <input type="button" class="button" onclick="javascript:setTime('start','{user_dateformat}');" value=" {APP.LBL_NOW_BUTTON_LABEL} "/></td>
</tr>
<tr>
<td nowrap="nowrap"><span class="dateFormat">{user_dateformat}</span></td>
<td nowrap="nowrap"><span class="dateFormat">{time_format}</span></td>
</tr>
</table>
</span sugar='slot'>
</td>
{CONTACT_POPUP}
</tr>
I believe that's all I had to do to get it working for us. Of course, this is not upgrade safe and is a bit of a hack but it works.
Bookmarks