How create a autoincrement field in a custom module?

Hello friends…

Again with questions around here …

I would like to know how I can create a numeric field that autoincremente with each record in a cpersonalizado module built from scratch … Something similar as having Cases module.

Thanks in advance to those who respond and help me with this.



This isnt something that would be possible out of the box with SuiteCRM
Thus, It would require custom code work to build.

Although, I believe someone found an installable package that supplies this functionality here:

You may wish to backup your db & CRM before installing this, just in case the functionality doesn’t work as you wish it to.

After installing the package, i would also recommend running a Repair & Rebuild and Repair Relationships. Both found in Admin > Repair.

Hopefully this supplies the functionality you require!

I wouldn’t recommend that module because it has problems when reaching the limits of 10000, after that it stopped counting at least for me, and noticing that after 10K records is not good.

I’ll try to find the tutorial where explains the best way to do this, is the same way that SuiteCRM uses for the “bugs” module, I had a bookmark in my browser but the SugarCRM Community change their forums a lot and all is lost now.

Basically the best way is to create an integer field and then set it to auto increment via sugardefs and after repair it this changes in the database. But then again, I don’t remember it very well and I’ll try to find the tutorial.

best regards

1 Like