default value for a custom field text box

Hi,

I would like to assign a default value for a text box (custom field) in meeting module.

Can anyone please guide me how can I set it and in what file should I apply the code?

If you go to Admin->Studio-> the module you want -> fields -> the field you want
Then you should see default value, and you can enter it there and then save it.

Hi Simeon,

I will assign a dynamic default value. It doesn’t seem to be possible within studio.

Can you please confirm what file should I edit?

I will also appreciate any idea please.

Thank you.

Create a view.edit.php for the module and then enter something like

 if($this->bean->id == null)
        {
            $this->bean->fieldname = "value";
        }

in the display function

Hi there!

In order to make Simeon’s solution work on SuiteCRM v7.11.8 I had to comment out the following four lines from EditView2.php:


if (!$valueFormatted) {
    // $this->focus->format_field($this->focus->field_defs[$name]);
    $value = isset($this->focus->$name) ? $this->focus->$name : '';
}

Any idea why this is the case? Maybe I should make an issue on the repo?

Thank you,
Guido

PS: Like the thread opener, I am trying to show a dynamic default value for a custom field. Contrary to the thread opener, I am doing it in the detail view rather than in the edit view.