Results 1 to 10 of 10

Thread: use custom field account to search contact in target list

  1. #1
    Beranrdi is offline Member
    Join Date
    Nov 2007
    Posts
    5

    Default use custom field account to search contact in target list

    Hi all,
    my problem was to use custom field (dropdown multiple) in account module to be used in searching contacts to create target list (popupPicker.html): finally i did it!

    First of all you have to create a dropdown list, name it "test_list_dom";
    then create a custom field in account module (use studio), name it "test_list" (the system will name it test_list_c") as multiple and use your test_list_dom as values;
    Now you have to modify 3 file: Popup_picker.html (in ./modules/Contacts/), popupdefs.php (in ./modules/Contacts/metadata/) and Contact.php (in ./module/Contacts/).

    in Popup_picker.html you have to add
    <td class="dataField">
    <select name='test_list[]' size='5' title='{TEST_LIST_C_HELP}' MULTIPLE=true>{OPTIONS_TEST_LIST_C}</select>
    </td>

    in popupdefs.php you array orginal array
    $popupMeta = array('moduleMain' => 'Contact',
    'varName' => 'CONTACT',
    'orderBy' => 'contacts.first_name, contacts.last_name',
    'whereClauses' =>
    array('first_name' => 'contacts.first_name',
    'last_name' => 'contacts.last_name',
    'account_name' => 'accounts.name',
    'account_id' => 'accounts.id'),
    'searchInputs' =>
    array('first_name', 'last_name', 'account_name'),
    'create' =>
    array('formBase' => 'ContactFormBase.php',
    'formBaseClass' => 'ContactFormBase',
    'getFormBodyParams' => array('','','ContactSave'),
    'createButton' => $mod_strings['LNK_NEW_CONTACT']
    )
    );
    go to ->
    $popupMeta = array('moduleMain' => 'Contact',
    'varName' => 'CONTACT',
    'orderBy' => 'contacts.first_name, contacts.last_name',
    'whereClauses' =>
    array('first_name' => 'contacts.first_name',
    'last_name' => 'contacts.last_name',
    'account_name' => 'accounts.name',
    'test_list'=>'accounts_cstm.test_list_c',
    'account_id' => 'accounts.id'),
    'selectDoms' => array('OPTIONS_TEST_LIST_C' =>
    array('dom' => 'test_list_dom','searchInput' => 'test_list'),
    ),

    'searchInputs' =>
    array('first_name', 'last_name', 'account_name','test_list'),
    'create' =>
    array('formBase' => 'ContactFormBase.php',
    'formBaseClass' => 'ContactFormBase',
    'getFormBodyParams' => array('','','ContactSave'),
    'createButton' => $mod_strings['LNK_NEW_CONTACT']
    )
    );

    finally, you have to modify your Contact.php at line 328, function create_list_query :

    $query .= "LEFT JOIN users
    ON contacts.assigned_user_id=users.id
    LEFT JOIN accounts_contacts
    ON contacts.id=accounts_contacts.contact_id and accounts_contacts.deleted = 0
    LEFT JOIN accounts
    ON accounts_contacts.account_id=accounts.id " .
    //add this
    " LEFT JOIN accounts_cstm on accounts_cstm.id_c=accounts.id";
    //end add

    Now you can use your custom field to filter contacts for your target list!

    bye all

    Marco

  2. #2
    Topol is offline Member
    Join Date
    Aug 2007
    Posts
    6

    Default Re: use custom field account to search contact in target list

    Thank you!
    That was really helpful and most appricitated!

    Cheers

  3. #3
    julian's Avatar
    julian is offline Sugar Team Member
    Join Date
    Sep 2004
    Posts
    1,639

    Default Re: use custom field account to search contact in target list

    Hello Beranrdi,

    This looks great. Would you consider posting this information in our Developer Wiki?

    http://www.sugarcrm.com/wiki/index.p...Developer_Wiki

    Thanks,
    Julian Ostrow
    Systems and Applications Engineer
    SugarCRM Inc.

  4. #4
    Beranrdi is offline Member
    Join Date
    Nov 2007
    Posts
    5

    Default Re: use custom field account to search contact in target list

    I have created a contribution at:
    http://www.sugarcrm.com/wiki/index.p...in_target_list

    bye

    Marco

  5. #5
    j14madd is offline Junior Member
    Join Date
    Jun 2008
    Posts
    2

    Question Re: use custom field account to search contact in target list

    Hi all,
    Does this code need any modification to work properly in 5.0e? I've adapted this code to the leads side of Sugar, but can't seem to get it to work consistently. It doesn't seem to matter what I do to the Popup_picker.html file. I've been able to remove chunks of the native code and it seems to have no bearing on how information is displayed. Are there any other places besides the three files you mentioned that may need to be altered in order for this to work in Leads?
    Thank you,
    -JM

  6. #6
    jpjanze is offline Member
    Join Date
    Aug 2008
    Posts
    6

    Default Re: use custom field account to search contact in target list

    Hi j14madd, I too am looking for this solution, let me know if you make any progress at all - what version of sugar are you on?

  7. #7
    vinod989 is offline Member
    Join Date
    Jun 2009
    Posts
    7

    Default Re: use custom field account to search contact in target list

    Quote Originally Posted by jpjanze View Post
    Hi j14madd, I too am looking for this solution, let me know if you make any progress at all - what version of sugar are you on?
    Yes you are right. It is not working in latest version.
    have you got the help for this.

  8. #8
    romaxl is offline Member
    Join Date
    Jun 2009
    Location
    Humpolec, Czech Republic
    Posts
    10

    Default Re: use custom field account to search contact in target list

    Hello there,

    I was looking for the solution how to create the target list with Contacts but based on search on fields in Accounts. I searched the Internet for the solution for this but did not find any. I did not want to create any search fields in Contacts module to Account module. This solution seemed to me somehow clamsy. Therefore I decided to create a small tool for this.

    I am not familiar with programing of modules for SugarCRM yet. So I have created a small PHP website that would enable me to do it. Using this site you can search Contacts based on Contacts and Accounts field. The reasult of the search can be saved to any existing Target list in Contacts. You can also Save your searches and load them and execute them anytime again.

    I thought maybe someone eklse could find this tool useful therefore I make it downloadable at website. You can download it here if you are interested: http://www.axlsystems.wz.cz/download...con_search.zip

    You can find installation instructions in read.txt file in the installation package. The code is not very clean and it is not definitelly very safe, therefore I suggest to use it with causion. And only administrators should be using it. This program works only on SugarCRM installation based on MySQL database. The program is tested and compatible with SugarCRM version 5.2.0. It has not been tested on any lower or higher version and installing and using it on lower or higher versions is on your own risk and responsibility. Always
    install and test the program on testing SugarCRM installation before installing it on your live version. The application is in English language only.

    Operating the program is pretty intuitive. I suggest to add this address to My Portal section. Using this you can add direct link to this program to main tab pannels and use it "inside" Sugar CRM. The application does not have any way of user authorazition and therefore I would suggest that only administrators are using it or programe your own authorization engine.

    In future I would like to reprogram the application as fully compatible SugarCRM module and make the application tranlatable and multi-lingual.

    Enjoy,

    Axl

  9. #9
    brandonchelo is offline Senior Member
    Join Date
    May 2010
    Posts
    27

    Default Re: use custom field account to search contact in target list

    can someone update this guide to 5.5?
    please

  10. #10
    brandonchelo is offline Senior Member
    Join Date
    May 2010
    Posts
    27

    Default Re: use custom field account to search contact in target list

    step two seems to still hold up to 5.5 but not the other two changes please guys! :-P

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 2006-09-22, 06:26 AM
  2. Asterisk Patch 1.1.0 Crash on logon
    By skyracer in forum Help
    Replies: 6
    Last Post: 2006-07-08, 06:30 AM
  3. Campaign Target List Advanced Search Needed
    By ivanw in forum General Discussion
    Replies: 2
    Last Post: 2006-03-21, 01:48 AM
  4. Replies: 2
    Last Post: 2005-09-12, 08:10 PM
  5. Contact Search Form - Custom Dropdown Field
    By aram in forum General Discussion
    Replies: 2
    Last Post: 2005-05-01, 03:57 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
  •