Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Create users from contacts

  1. #1
    mhuntsinger is offline Member
    Join Date
    Jul 2008
    Posts
    8

    Default Create users from contacts

    I just imported contacts to Sugar. The contacts are the employees at our company, and I want to create user accounts for them without doing them one by one. How would I go about doing this?

    Any help would be appreciated

    Thanks

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Create users from contacts

    Hi mhuntsinger.

    There are no feature to do that.

    You need to create a script which create a user for each contact.
    You also will need to define the password and user_name for them.
    You can access this script in address bar:

    index.php?module=Contacts&action=CreateUsers

    This script (CreateUsers.php) should be saved into modules/Contacts/ folder.

    Cheers.
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    mhuntsinger is offline Member
    Join Date
    Jul 2008
    Posts
    8

    Default Re: Create users from contacts

    Thanks for the help andopes. I'll try that.

  4. #4
    mhuntsinger is offline Member
    Join Date
    Jul 2008
    Posts
    8

    Default Re: Create users from contacts

    Hi Andopes. When I try to go to index.php?module=Contacts&action=CreateUsers it tells me "there is no action by that name".


    Any suggestions?

    Thanks

  5. #5
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Create users from contacts

    Hi mhuntsinger.

    Accordingly to my suggestion you need to create the script modules/Contacts/CreateUsers.php
    After this you can access it.

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  6. #6
    mhuntsinger is offline Member
    Join Date
    Jul 2008
    Posts
    8

    Default Re: Create users from contacts

    Hi Andopes

    I was able to find basic information about .php coding. Such as "<? php" begins the .php section of the code and "?>" ends the php section of the html. But where can I find information about how I would write the kind of code that I need to make users from my contact list.

    Thanks Again

  7. #7
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Create users from contacts

    Hi mhuntsinger

    The script looks like that:

    PHP Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    if(! 
    class_exists('Contact')) {
        require_once(
    'modules/Contacts/Contact.php');
    }

    $contact_bean = new Contact();
    $contact_list $contact_bean->get_list();

    foreach(
    $contact_list['list'] as $contact) {
        
    $user = new User();
        
        foreach(
    $contact->field_defs as $field => $defs) {
            if(
    $contact->$field != '' && is_string($contact->$field) && isset($user->$field)) {
                
    $user->$field $contact->$field;
            }
        }

        
    $user->user_name substr($user->first_name01) . $user->last_name;
        
    $user->user_hash md5($user->user_name);
        
    $user->status 'Active';
        
    $user->save();
    }
    ?>
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  8. #8
    mhuntsinger is offline Member
    Join Date
    Jul 2008
    Posts
    8

    Default Re: Create users from contacts

    Thanks

    I'll try that and let you know if I get it

  9. #9
    mhuntsinger is offline Member
    Join Date
    Jul 2008
    Posts
    8

    Default Re: Create users from contacts

    Hi Andopes

    Thanks for all of your help so far.

    I have a couple more questions though.

    I put the file CreateUsers.php with the code that you gave me into sugarcrm/modules/contacts

    Then I was able to go to index.php?module=Contacts&action=CreateUsers in the address bar like you said.

    I then imported the contacts from that screen. But the contacts were not created as users. I went to admin/user management to check the users and they weren't in there.

    Any suggestions

    Thanks

  10. #10
    mhuntsinger is offline Member
    Join Date
    Jul 2008
    Posts
    8

    Default Re: Create users from contacts

    Actually, now that I look at the user management it looks like there were users that were created but they are blank. There is no information in any of them, like the name the user name or the department. As it is I would still need to manually put in all the information for each user. How would I fix this so that the information is in there?

    Thanks

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Select Users from contacts list
    By stheologo in forum Help
    Replies: 7
    Last Post: 2008-11-13, 02:38 PM
  2. Replies: 0
    Last Post: 2008-02-13, 02:32 PM
  3. Users vs contacts
    By synchro in forum General Discussion
    Replies: 0
    Last Post: 2006-09-05, 05:15 PM
  4. Replies: 1
    Last Post: 2006-02-08, 07:29 PM
  5. Users -> Contacts info
    By stevej in forum Web Self Service Portal
    Replies: 0
    Last Post: 2005-08-29, 04:08 AM

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
  •