fab
19 April 2022 09:21
#1
I’ve created a simple INT field in Studio and I’ve set the default value to be 1, but going into the module, that field is empty. I tried to insert the default value also via code in:
suitecrm\custom\Extension\modules\<custom_module>\Ext\Vardefs\_override_sugarfield_<custom_field>
with
$dictionary['<custom_module>']['fields']['<custom_field>']['default']=1;
or
$dictionary['<custom_module>']['fields']['<custom_field>']['default']='1';
but it doesn’t work. it’s really annoying because it’s a stupid problem, but it’s necessary, does anyone know how to solve it? Thanks.
SuiteCRM Version 7.10.20
Sugar Version 6.5.25 (Version 344)
Have you run a Quick Repair and Rebuild after the change?
fab
19 April 2022 16:14
#3
Yes, it’s the first thing I did
I’m suspecting it’s related to file permissions. Make sure they are correct and your web user is included in the config file. Check here for more info:
Downloading and installing SuiteCRM If you are installing SuiteCRM for the first time, follow the instructions in this section. If you have an earlier version of SuiteCRM installed, refer to the upgrade section for instructions on how to upgrade your...
fab
19 April 2022 17:04
#5
I am testing it locally and I have given the maximum permissions to the folders (windows system)
(Usas Xampp o el servidor nativo de Windows?) Sorry I meant to ask you if you are using xampp or the native web server of Windows?
pgr
19 April 2022 18:26
#7
A first thing to check is if the QR&R was able to find those changes and pull them into
custom/Ext/modules/…
This is what I use:
<?php
$dictionary['test_testModule']['fields']['num1'] = array(
...
'value' => 1,
...
);
fab
20 April 2022 08:38
#9
@BrozTechnologies
I use xampp.
@pgr
I can’t find any ‘custom/ext/…’ line.
@Zetsubou5990
Your solution works, just what I wanted, the problem though is that it doesn’t allow me to edit it. It sets the field to 1, but if I want to modify it, it doesn’t work, it remains at 1.
My mistake, you’re right, the value attribute is the wrong one to do what you wanted because whatever you enter will just get overridden by the value attribute.
However I tried what you did and used default attribute and it works for me though…
fab
20 April 2022 09:18
#11
using the default_value attribute, the value ‘1’ appears only in the Edit phase, but not in the detail (as it happens setting ‘value’ in your example)
Interesting…
Here are my results when I use the Default attribute:
In my custom vardefs file:
It shows the default value:
Inserting a different value:
The new value displays on the detailview. I even logged out and closed my browser just to make sure…
fab
20 April 2022 10:09
#13
I misspoke, I’ll try to be more specific:
I set in
suitecrm\custom\Extension\modules\<custom_module>\Ext\Vardefs\_override_sugarfield_<custom_field>
the default value:
$dictionary['<custom_module>']['fields']['<custom_field>']=array('default_value' =>1);
(‘default’ =>1 does not work)
I do Q&R
in Detail of the module in question does not appear any value
I go to Actions->Edit and I see my field set to 1
I modify the field, for example 5 and save
I return to Detail and see the change (before there was nothing, now there is 5, the new value)
pgr
20 April 2022 10:17
#14
Sorry, I meant
custom/modules/TheCustomModuleName/Ext