Results 1 to 5 of 5

Thread: Making a custom field populate on creation

  1. #1
    aheuermann is offline Sugar Community Member
    Join Date
    May 2006
    Posts
    61

    Question Making a custom field populate on creation

    I have a custom account number field in the account module. I want to have a sequential account number added to the field upon creation of an account. I know how I will read form the database and assign the sequential number, but I am unsure as to where the function should be added to the application. I would need to sheck if it is a new account, and if so calculate account number. Any help would be greatly appreciated.
    Thanks in advance!

  2. #2
    sacramentojoe is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    447

    Default Re: Making a custom field populate on creation

    Quote Originally Posted by aheuermann
    I have a custom account number field in the account module. I want to have a sequential account number added to the field upon creation of an account. I know how I will read form the database and assign the sequential number, but I am unsure as to where the function should be added to the application. I would need to sheck if it is a new account, and if so calculate account number. Any help would be greatly appreciated.
    Thanks in advance!
    At what stage of the process does this action need to occur?
    Save? When you create a new one?

  3. #3
    simple is offline Sugar Community Member
    Join Date
    Jul 2005
    Posts
    259

    Default Re: Making a custom field populate on creation

    You could add your code to the file modules/Accounts/EditView.php right before the line $xtpl->parse("main");

    If the id is not set, a new record will be created.

    Accounts/EditView.php

    PHP Code:
    ...

    // add code here
    if ( $focus->id == "") {
      
    // get $seqId
     
      // assign it to field
      
    $xtpl->assign("YOUR_CUSTOM_FIELD_C"$seqId);
    }

    $xtpl->parse("main");
    $xtpl->out("main");

    ... 
    Cheers Pascal
    Simplicity GmbH

  4. #4
    aheuermann is offline Sugar Community Member
    Join Date
    May 2006
    Posts
    61

    Default Re: Making a custom field populate on creation

    Quote Originally Posted by sacramentojoe
    At what stage of the process does this action need to occur?
    Save? When you create a new one?
    It needs to occur on the creation of a new account. when the editview is initially brought up I want the field populated.

  5. #5
    corpoint is offline Junior Member
    Join Date
    Sep 2006
    Posts
    4

    Default Re: Making a custom field populate on creation

    I need to have fields that are already in SugarCRM populate automaticly. Please advise on if that is possable.

    Thanks

Thread Information

Users Browsing this Thread

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

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
  •