Results 1 to 6 of 6

Thread: How to Generate a unique customer code.

  1. #1
    damanic is offline Member
    Join Date
    Feb 2008
    Posts
    8

    Default How to Generate a unique customer code.

    Hi,

    I installed this software today, and im trying to figure out how even the simplest of things work.

    I want to edit the accounts module so that it will fit in with our current database of customer accounts. Currently we are generating CT#'s for customers in the format CT000000

    I would like to be able to create an account in sugar and have a unique code generated each time a new account is created. We will still create accounts on our old setup so it would have to be a format like - CTS00000

    Im still debating whether I should create my own contacts interface from scratch or tap into this snazzy looking peice of software. Perhaps if someone could explain how I do the above, i'll get some insight into how easy/difficult adapting this software is likely to be.

    - Matt

  2. #2
    ptemplin7 is offline Sugar Community Member
    Join Date
    Jun 2007
    Location
    Puget Sound Washington
    Posts
    380

    Default Re: How to Generate a unique customer code.

    Hi Matt,

    Search the forum for this. It is well documented from my troubles getting this to work.

    In essence what you need is a logic hook. I have implemented this to create a customer incrementing account number for my customers.

    search on Custom logic hooks in the help look for Superman's and ptemplin7 issues. I will update this if I can find the link again!

    Paris

  3. #3
    ptemplin7 is offline Sugar Community Member
    Join Date
    Jun 2007
    Location
    Puget Sound Washington
    Posts
    380

    Lightbulb Re: How to Generate a unique customer code.

    here's the link!

    http://www.sugarcrm.com/forums/showt...gic+hook+paris

    Look for other linked to this one as well.

    Paris

  4. #4
    damanic is offline Member
    Join Date
    Feb 2008
    Posts
    8

    Default Re: How to Generate a unique customer code.

    Thanks ptemplin,

    The attached files in those threads have given me what im looking for code wise. Im just wondering where I put this code.

    So far i've only used the studio to create new fields and arrange the forms. Im not sure how to include the files to make this work. There does not seem to be a panel to insert or link to new php code. So how do I go about installing these hooks and functions?

  5. #5
    damanic is offline Member
    Join Date
    Feb 2008
    Posts
    8

    Default Re: How to Generate a unique customer code.

    Ok I got it,

    I put the class/function in -> /custom/include/

    the hook in /custom/modules/accounts/

    Nice and easy.

    The msql function you posted was not set to return the integer.. so I used

    DELIMITER $$

    DROP FUNCTION IF EXISTS `crm`.`get_ct_number`$$

    CREATE DEFINER=`root`@`localhost` FUNCTION `get_ct_number`() RETURNS int(3)
    BEGIN
    declare onr integer;
    update crm.config
    set `value`=cast(`value` as unsigned) + 1
    where category='matt'
    and name='CTGen';
    SELECT `value`
    FROM crm.config
    where category='matt'
    and name='CTGen'
    into onr;

    RETURN onr;

    END$$

    DELIMITER ;


    Thanks for this - now I understand how you can add logic to the modules. Its quite simple actually - onwards!

  6. #6
    ptemplin7 is offline Sugar Community Member
    Join Date
    Jun 2007
    Location
    Puget Sound Washington
    Posts
    380

    Default Re: How to Generate a unique customer code.

    Glad to help,

    Maybe we ought to put a Wiki entry for this. It's already partly there but this seems to come up regularly!

    Paris

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Integrating a unique field with Sugar
    By tomkerswill in forum Help
    Replies: 7
    Last Post: 2012-01-25, 03:44 AM
  2. generate some poopus
    By holdjul in forum Help
    Replies: 1
    Last Post: 2007-08-04, 07:47 PM
  3. Universal customer overview page
    By gfa in forum Help
    Replies: 0
    Last Post: 2007-05-16, 08:16 PM
  4. where is the html code that creates the pages in sugarcrm
    By santosh.ghalsasi in forum General Discussion
    Replies: 2
    Last Post: 2007-03-03, 07:20 AM
  5. Replies: 2
    Last Post: 2006-04-12, 02:20 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
  •