Results 1 to 8 of 8

Thread: assigning a case to a contact?

  1. #1
    cdembek is offline Sugar Community Member
    Join Date
    Apr 2007
    Posts
    18

    Default Adding custom field to Case edit layout???

    I am trying to add a custom field "Contact" which works much like the Account field/search with in the create/edit of a Case entry.

    I know where to go in order to create a new custom field, however not sure how to get the custom field to work like the Account field,

    Any suggestions??
    Last edited by cdembek; 2007-08-25 at 02:50 AM.

  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: Adding custom field to Case edit layout???

    Well, cdembek

    Able cases to work with contact is not right simple because the Cases module work on context of Accounts. To provide this new behavior I believe you should modify a lot the Cases module or create a copy to join contacts.

    Cheers.

    André Lopes
    Lâmpada Global Services
    Av. Angelica, 1814 cj. 1502
    São Paulo, SP 01228-200
    tel1. 55 11 3668-6776
    tel2. 55 11 3822-2581
    cel. 55 11 7636-5859
    messenger: andopes@yahoo.com.br
    skype: andopes
    e-mail: andre@lampadacrm.com.br


    Quote Originally Posted by cdembek
    I am trying to add a custom field "Contact" which works much like the Account field/search with in the create/edit of a Case entry.

    I know where to go in order to create a new custom field, however not sure how to get the custom field to work like the Account field,

    Any suggestions??

  3. #3
    cdembek is offline Sugar Community Member
    Join Date
    Apr 2007
    Posts
    18

    Default Re: assigning a case to a contact?

    Can't I just create a custom button/field and have it work just like the account field???

  4. #4
    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: assigning a case to a contact?

    Unfortunately no, cdembek.

    Cases does not work this way.

    It was built to interact directly to accounts.

    Cheers

    André Lopes
    Lâmpada Global Services
    Av. Angelica, 1814 cj. 1502
    São Paulo, SP 01228-200
    tel1. 55 11 3668-6776
    tel2. 55 11 3822-2581
    cel. 55 11 7636-5859
    messenger: andopes@yahoo.com.br
    skype: andopes
    e-mail: andre@lampadacrm.com.br

    Quote Originally Posted by cdembek
    Can't I just create a custom button/field and have it work just like the account field???

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

    Default Re: assigning a case to a contact?

    Cases do work this way in some manner since they are tied to contacts (see subpanels). It's not exactly like Accounts where a case is tied to directly one account but you can add multiple contacts to a case. If you want to add a contact to a case when adding a new case instead of saving then adding using the subpanel you can make some small changes to do that. It'll then save the contact in the subpanel contact list though which should be sufficient for what you need. Basically it's a way to set a primary contact immediately when creating the case.

    In modules\Cases\EditView.php add this could before the INBOUND EMAIL HANDLING area:
    PHP Code:
    /** eggsurplus: added contact popup for new case */

    if( (!isset($focus->id) || $focus->new_with_id ) && !isset($focus->contact_id)) {
        
    //contact popup...show only if new record to more quickly associate a contact to a case
        
    $popup_request_data = array(
            
    'call_back_function' => 'set_return',
            
    'form_name' => 'EditView',
            
    'field_to_name_array' => array(
                
    'id' => 'contact_id',
                
    'name' => 'contact_name',
                ),
            );

        
    $encoded_contact_popup_request_data $json->encode($popup_request_data);

        
    $contact_popup "    <td class='dataLabel'><span sugar='slot90'>Primary Contact:</span sugar='slot'></td> "
                        
    ."    <td class='dataField'><span sugar='slot90b'> "
                        
    ."    <input tabindex='2' readonly id='contact_name' name='contact_name' type='text' value=''> "
                        
    ."    <input id='contact_id' name='contact_id' type='hidden' value='' /> "
                        
    ."    <input title='".$app_strings['LBL_SELECT_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_SELECT_BUTTON_KEY']."' type='button' tabindex='2' class='button' value='".$app_strings['LBL_SELECT_BUTTON_LABEL']."' name=btn1 "
                        
    ."            onclick='open_popup(\"Contacts\", 600, 400, \"\", true, false, ".$encoded_contact_popup_request_data.");' /></span sugar='slot'></td> ";
    } else {
        
    $contact_popup "    <td class='dataLabel'><span sugar='slot98'>&nbsp;</span sugar='slot'></td> "
                        
    ."    <td class='dataField'><span sugar='slot99'>&nbsp;</span sugar='slot'></td> ";
    }
    $xtpl->assign('CONTACT_POPUP'$contact_popup);
                            
    /** end eggsurplus custom */ 
    In modules\Cases\EditView.html add {CONTACT_POPUP} somewhere in the place of the two td cells where you would like it to go (see bottom of this code block):
    PHP Code:
        <tr valign="top">
        <
    td class="dataLabel"  valign="top"><span sugar='slot9'>{MOD.LBL_DATE_START_TIME} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></span sugar='slot'></td>
        <
    td class="dataField"><span sugar='slot9b'>

            <
    table border="0" cellpadding="0" cellspacing="0">
            <
    tr>
            <
    td nowrap="nowrap"><input name="date_start" onblur="parseDate(this, '{CALENDAR_DATEFORMAT}');" id="date_start_field" tabindex="1"
                
    size="11" maxlength="10" type="text" value="{date_start}" />
            <
    img src="themes/{THEME}/images/jscalendar.gif" alt="{MOD.LBL_DATE_START_TIME}"
                
    id="date_start_picker" align="absmiddle" />&nbsp;&nbsp;</td>
            <
    td nowrap="nowrap"><input name="time_start" id="time_start" tabindex="1" size="5"
                
    maxlength="5" type="text" value="{time_start}" />{time_start_meridian} <input type="button" class="button" onclick="javascript:setTime('start','{user_dateformat}');" value=" {APP.LBL_NOW_BUTTON_LABEL} "/></td>
            </
    tr>
            <
    tr>
            <
    td nowrap="nowrap"><span class="dateFormat">{user_dateformat}</span></td>
            <
    td nowrap="nowrap"><span class="dateFormat">{time_format}</span></td>
            </
    tr>
            </
    table>

            </
    span sugar='slot'>
        </
    td>
        {
    CONTACT_POPUP}
        </
    tr
    I believe that's all I had to do to get it working for us. Of course, this is not upgrade safe and is a bit of a hack but it works.

  6. #6
    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: assigning a case to a contact?

    Hi, eggsurplus.

    Thank you a lot for your great explanation.

    Cheers.

    André Lopes
    Lâmpada Global Services
    Av. Angelica, 1814 cj. 1502
    São Paulo, SP 01228-200
    tel1. 55 11 3668-6776
    tel2. 55 11 3822-2581
    cel. 55 11 7636-5859
    e-mail: info@lampadacrm.com.br

  7. #7
    luis.sg is offline Sugar Community Member
    Join Date
    Jul 2007
    Location
    Barcelona (Spain)
    Posts
    18

    Default Re: assigning a case to a contact?

    Hi,

    I have used this technique to attach a note to a user, and it displays OK. But the assigned user is not saved in the database, I guess I have to change the sql? Or maybe somewhere in the vardefs.php file, to let the module know that it has a new field to treat?

    Thank you,
    Luis Serrano
    Presence Technology - Solutions Developer
    www.presenceco.com

    Ls-Art.com - Photographer
    www.ls-art.com · www.ls-art.co.uk · www.escaparatevisual.com · www.syndicarts.com

  8. #8
    WEB11 is offline Senior Member
    Join Date
    Mar 2009
    Location
    Washington, DC
    Posts
    30

    Default Re: assigning a case to a contact?

    Hi,

    I looked under modules\Cases\ But I cannot find the mentioned EditView.php file there. Did it get moved after 5.2 or something?

    Luis, Did you find a solution to the note problem?

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 15
    Last Post: 2010-04-01, 04:04 PM
  2. Case / contact relationship issue
    By IsOxfordDavid in forum General Discussion
    Replies: 0
    Last Post: 2007-03-07, 03:02 PM
  3. Assign a new case to a Contact not an Account
    By digitalfriction in forum Help
    Replies: 1
    Last Post: 2007-01-15, 08:39 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
  •