Reference alternative fields

Hello - is there a way to reference fields other than those with the ‘name’ data type? I have Job Card and Equipment Schedule modules that I’ve built, and would like the Job card to be able to lookup the Serial Number of an item in the Equipment Schedule, but the only thing I can reference is the item name, or the customer name.

Can this be done, and if so, how?

Many thanks,

Andrew.

Hello,

you can add the field to your vardefs so it will be available to your job card module.

I’ll show you an example on how to add the accounts postal code to contacts:

Create a file:


custom/Extension/modules/Contacts/Ext/Vardefs/account_postalcode.php

with the contents:


$dictionary['Contact']['fields']['account_postalcode'] = 
	array (
			name' => 'account_postalcode',
			'rname' => 'billing_address_postalcode',
			'id_name' => 'account_id',
			'vname' => 'LBL_ACCOUNT_POSTALCODE',
			'type' => 'relate',
			'link' => 'accounts',
			'table' => 'accounts',
			'isnull' => 'true',
			'module' => 'Accounts',
			'dbType' => 'varchar',
			'len' => '255',
			'source' => 'non-db',
			'unified_search' => true,
		);

Create a file:


custom/Extension/modules/Contacts/Ext/Language/en_us.account_postalcode.php

with contents:


<?php
$mod_strings['LBL_ACCOUNT_POSTALCODE'] = 'Account Postal Code:';

Do a Admin / Repair / Quick Repair and Rebuild afterwards.

See if you can figure it out to create the appropiate vardefs for the field Serial Number to the module Job Card.

See also:
https://suitecrm.com/forum/developer-help/4598-grab-fields-from-a-related-record-without-sugar-logic