skip to Main Content

I am using SuiteCRM-7.11.5 on Windows. I want to create an ID Label which shows itself auto incremented in the the “Create New Task” window. If showing auto incremented is not possible I at least want it to auto increment in the mySQL database.

I’ve found some question in Stack Overflow and on SuiteCRM forum (No Extension folder) which are all outdated or didn’t work at all. The plugins are removed from github. Any help, hack or work around is appreciated. I am also new to suitecrm and mysql so step by step answer would be appreciated.

I also tried adding auto increment option in phpmyadmin but it throw error as

Incorrect column specifier for column ‘id’

2

Answers


  1. Create int type field and create before save logic hook. Add below code,

    global $db;
        $query = "SELECT MAX(field_name) as max_count FROM table where deleted=0";
        $result = $db->query($query);
        $row = $db->fetchByAssoc($result);
        $max_number = $row['max_count'];
        if(empty($max_number)){
            $max_number = 1;
        }
        else{
            (int)$max_ticket_number++;
        }
        if(empty($bean->field_name)){
            $bean->field_name = $max_ticket_number;
        }
    }
    
    Login or Signup to reply.
  2. Auto Increment is definitely possible in suiteCRM, all you need to put a field using code like this.

     'auto_number' =>
                array(
                    'name' => 'auto_number',
                    'vname' => 'Serial No',
                    'type' => 'int',
                  'len' => 11,
                  'required'=>true,
                  'auto_increment' => true,
                ),
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search