Results 1 to 2 of 2

Thread: Howto generate a unique (autoincrementing) number in custom modules

  1. #1
    dushara is offline Junior Member
    Join Date
    Nov 2009
    Posts
    1

    Default Howto generate a unique (autoincrementing) number in custom modules

    Hi all,

    I just started looking at SugarCRM to see if it can help me set-up a simple system to manage simple business transactions. For the transaction record (a module I created) I need an auto incrementing (read-only) number field that I can use as a receipt number - similar to the number field in the bug tracker. So far I haven't been able to figure out how to do this.

    I even tried using http://kb.sugarcrm.com/custom/studio...dule-editview/ as a guide but without much luck.

    How can I get the behaviour I'm after?

    Thanks in advance.

    dushara

  2. #2
    mtvtaras's Avatar
    mtvtaras is offline Sugar Community Member
    Join Date
    Nov 2009
    Posts
    82

    Default Re: Howto generate a unique (autoincrementing) number in custom modules

    Hi dushara!

    You should write in vardefs.php
    PHP Code:
    $dictionary['module_name'] = array(
    ................
      
    'inc_field' =>
      array (
      .........
        
    'required' => false,
        
    'name' => 'inc_field',
        
    'vname' => 'LBL_FIELD',
        
    'type' => 'int',
        
    'len' => '20',
        
    'auto_increment'=>'true',
      .........
      ),
      .............

    ),
       
    'indices' => array (
       
    =>
       array(
          
    'name' =>'ind_inc_field',
          
    'type'=>'unique',
          
    'fields'=>array(=> 'inc_field'),
        ),
    ),
    ............... 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. HOWTO: Hack - Relate to custom modules pre 5.1
    By kenneth.thorman in forum Developer Tutorials
    Replies: 4
    Last Post: 2011-02-07, 06:42 AM
  2. Unique Number Incremental
    By DanBrown in forum Help
    Replies: 8
    Last Post: 2008-09-11, 06:47 PM
  3. How to Generate a unique customer code.
    By damanic in forum Help
    Replies: 5
    Last Post: 2008-03-02, 07:01 PM
  4. How to generate list from several modules
    By jlarvie in forum Developer Help
    Replies: 3
    Last Post: 2007-11-20, 03:04 PM
  5. howto limit number of users
    By cvd in forum Help
    Replies: 2
    Last Post: 2006-03-17, 06:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •