Hi,
I do not need to re-write what you have written. I am sorry you feel you are wasting your time. I am following everything you have advised and still no joy. I am relatively in-experienced at this, so being criticised for my posts in that way is not exactly helpful. Shall I try again?
I have a field in the 'Companies' table, with the following:
Field: Allocation Status
Caption: BDT Allocation Status
Data Type: Select field
Source of Data: CommonData
Type: Single value selection
Order by: Key
CommonData table: Allocation_Status
Table view: ticked
Tooltip view: not ticked
Required: not ticked
Filter enabled: ticked
Export: ticked
Value display function: empty
Field generator function: empty
In CommonData, I have the following entry:
Key: Allocation_Status
Value: empty
Under this I have:
Key: not_allocated
Value: Not Allocated
I would like, when a user clicks on "Add New" to add a new company, that when the entry screen is displayed, the field "Allocation Status" is automatically set to and shows as "Not Allocated", but which the user can then change to another selection from the list if appropriate.
I have followed your advice, and:
Create dir and file
modules/Custom/MyCallbacks.php
<?php
class MyCallbacks {
public static function process_company($values, $mode) {
if ($mode == 'adding') $values['allocation_status'] = 'not_allocated';
return $values;
}
}
I then went into Admin Tools and run the PHP command:
\Utils_RecordBrowserCommon::register_processing_callback('company', array('Custom_MyCallbacks', 'process_company'));
When I now go into "Add New" Company, the field Allocation Status is still shown as empty instead of "Not Allocated".
Im not sure, what more you want me to write, or how you want me to describe it. I am sorry I am not technically at your level, but that is why I came on here asking for help.
What you have provided so far, is very helpful and I do value your time, thank you.
Dave