Results 1 to 4 of 4

Thread: Autopopulate custom field.

  1. #1
    enrikm is offline Sugar Community Member
    Join Date
    Dec 2006
    Posts
    61

    Default Autopopulate custom field.

    Good morning all,

    I have tried to study how the ASSIGNED_USER_NAME variable automatically populates the Assigned User Name field upon creating a new record. However, this seems to be a tall order and I have yet to duplicate this.

    Say I have created a new field in the users module called branch and I have a custom field in my Project module called branch. What I want to do is to automatically fill up this field with the branch of the user who created it.

    Is there a simpler way to do this than imitatng the implementation of the ASSIGNED_USER_NAME variable?

    Thanks

  2. #2
    enrikm is offline Sugar Community Member
    Join Date
    Dec 2006
    Posts
    61

    Default Re: Autopopulate custom field.

    Any insights on this one?

  3. #3
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Autopopulate custom field.

    PHP Code:
    global $current_user;
    //if new record
    if(empty($focus->id)) { 
    $xtpl->assign("BRANCH",$current_user->branch_c); //where branch_c is a custom user field

    This probably doesn't do it but may give you some ideas.

  4. #4
    enrikm is offline Sugar Community Member
    Join Date
    Dec 2006
    Posts
    61

    Default Re: Autopopulate custom field.

    Ey thanks for this. Will try to explore it.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. custom field to sugar field
    By tanhaa in forum Developer Help
    Replies: 2
    Last Post: 2011-05-04, 03:52 PM
  2. Custom Field add not visible is Edit Layout
    By tylerpoint in forum Help
    Replies: 0
    Last Post: 2007-07-09, 05:56 AM
  3. Asterisk Patch 1.1.0 Crash on logon
    By skyracer in forum Help
    Replies: 6
    Last Post: 2006-07-08, 06:30 AM
  4. Replies: 7
    Last Post: 2006-06-06, 07:56 PM
  5. Replies: 3
    Last Post: 2005-10-21, 05:28 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
  •