How to add a Autoincrement field for Account and Contacts

I fixed the issue.
The database table hadn’t written the field as an autoincrement index

Also check here -> https://suitecrm.com/forum/suitecrm-7-0-discussion/11181-simplify-the-id-field-in-tables
It is a different way to autoincrement with a before_save hook. and if you do some modifications you can add to this prefix-suffix-date-time or whatever you want.

Is there any way to bring the next autoincrement value in Default Value of the Integer

Hi, thanks for your contributions, you can tell me what I am doing wrong by following the following steps:
I use Version 7.10.6
Sugar Version 6.5.25
1.- Module of Contracts
2.- Add the field name: auto_folio_c
3.- Add the code in …custom \ Extension \ modules \ AOS_Contracts \ Ext \ Vardefs
4.- fields Code:

“autoincrement.php”

$ dictionary [‘AOS_Contracts’] [‘fields’] [‘auto_folio_c’] = array
(
‘name’ => ‘auto_folio_c’,
‘vname’ => ‘LBL_AUTO_FOLIO’,
‘type’ => ‘int’,
‘readonly’ => true,
‘len’ => 11,
‘auto_increment’ => true,
‘disable_num_format’ => true,
);

“sugarfield_auto_folio_c.php”
$ dictionary [‘AOS_Contracts’] [‘fields’] [‘auto_folio_c’] [‘auto_increment’] = true;
5.- Fast repair in SuiteCRM

Results:
Field Folio in White, without increment, you can mention me because it does not work, to share to all the steps to follow.

Thank you very much

Hi, try it as your example and throw me the following error:

MySQL error 1075: Incorrect table definition; there can be only one auto column and it must be defined as a key

Because the created field is not a primary key but the table it creates is aos_contracts_cstm, the ID is defined as a PK and as we know by rule, only a primary key can exist. Do you know how I can solve this or what am I doing wrong?

Great code. I am no coder but I was able to follow this and make it work. thank you.

Hey ! Please help me also.I also want to do the same scenario of Auto Increment for accounts Section

What will be the values for NAME_FOR_INDEX and indices and fields ?

What this code does ? How i check i don’t find any changes in my system. Where this field will add and how can i check if added or not ?

I Want to Create one unique number field in Account module. This field is auto generate and alpha numeric. When account is created then this field value will auto genetare and must be unique.

Please create a new topic instead of posting on year old threads