title: How to replace a build in relationship field by a flexrelate field
body: <p>For example in Opportunities and Cases there are relationship fields directly pointing to accounts. I have a custom module that integrates into those modules. I could add a separate relate field for the custom module, but what I want is a flexrelate allowing only Accounts and the Custom module. This works fine by setting a special options list in the parent_name. but results in a parent_type and parent_id field in db.</p>
  
  <p>How do I configure the flexrelate so that on selecting accounts as parent_type it save to account_id and on selecting the custom module it saves to it's id field?</p>
  
  <p>The options for the flexrelate:</p>
  
  <pre><code>$app_list_strings['parent_type_display_custom']['CustomMod'] = 'CustomMod';
  $app_list_strings['parent_type_display_custom']['Accounts'] = 'Accounts';
  $app_list_strings['record_type_display_custom']['CustomMod'] = 'CustomMod';
  $app_list_strings['record_type_display_custom']['Accounts'] = 'Accounts';
  </code></pre>
  
  <p>The additional vardefs for Cases:</p>
  
  <pre><code>$dictionary["Case"]["fields"]["parent_type"] = array (
    'name' =&gt; 'parent_type',
    'type' =&gt; 'link',
              'vname' =&gt; 'LBL_PARENT_TYPE',
              'type' =&gt; 'parent_type',
              'dbType' =&gt; 'varchar',
              'group' =&gt; 'parent_name',
              'options' =&gt; 'parent_type_display_custom',
              'len' =&gt; '255',
  
          );
  $dictionary["Case"]["fields"]['parent_name'] =
          array(
              'name' =&gt; 'parent_name',
              'parent_type' =&gt; 'record_type_display',
              'type_name' =&gt; 'parent_type',
              'id_name' =&gt; 'parent_id', 
              'vname' =&gt; 'LBL_RELATED_TO',
              'type' =&gt; 'parent(_custom)',
              'source' =&gt; 'non-db',
              'options' =&gt; 'record_type_display_custom',
          );
  $dictionary["Case"]["fields"]['parent_id'] =
          array(
              'name' =&gt; 'parent_id',
              'vname' =&gt; 'LBL_PARENT_ID',
              'type' =&gt; 'id',
              'required' =&gt; false,
              'reportable' =&gt; true,
              'comment' =&gt; 'eighter the Id of an account or a custommodule'
          );
  </code></pre>