Results 1 to 6 of 6

Thread: Inherit Team from Accounts

  1. #1
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Inherit Team from Accounts

    Hi,

    Is it possible that when I create any record under an Account that this new record is automatically assigned to the same team as the Account is - rather then the users private team??

    Rgds
    Chris

  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: Inherit Team from Accounts

    Hi Chris

    Are you using any licensed version (PRO, ENT)?
    I believe it is possible to perform creating any Workflow.

    Best regards.
    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
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Re: Inherit Team from Accounts

    Yes - We have the Pro version - I will look into this thanks.

  4. #4
    maloner's Avatar
    maloner is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Westmeath & Dublin
    Posts
    95

    Lightbulb Re: Inherit Team from Accounts

    Hi Chris,

    I think this can be done in a number of ways:

    1) via a workflow - you would need to create a workflow for each module related to accounts.

    2) via logic hooks - this reqires some PHP code.

    3) via inheritable fields (auto-populate the value when creating a new child from a subpanel)

    Here is some more info on option 3:

    Auto-populate the PARENT value when creating a new CHILD from the subpanel
    Edit the following file (create if necessary):

    If your CHILD module is an OOB Module:
    custom/modules/<CHILD>/views/view.edit.php (Ext mechanism cannot be used)

    If your CHILD module is a Custom Module:
    modules/<CHILD>/views/view.edit.php


    (modules/CHILD/views/view.edit.php) The Custom Relate field is not automatically filled in when you click on the Create button on the subpanel to create a new CHILD record. The following is one way to do it, using a custom EditView for the CHILD module to extract the PARENTs information from the form post data. (With thanks to David O'Keefe - see thread http://www.sugarcrm.com/forums/showthread.php?p=91427 for his original description of this solution)

    <?php

    require_once('include/MVC/View/views/view.edit.php');

    class <CHILD>ViewEdit extends ViewEdit{

    function <CHILD>ViewEdit() {
    parent::SugarView();
    }

    function display(){
    $this->ev->process();
    if (empty($this->ev->focus->id) && ($_REQUEST['parent_type'] == '<PARENT>'&& isset($_REQUEST['parent_name']) && isset($_REQUEST['parent_id']))) {
    $this->ev->fieldDefs['<FIELDNAME>_c']['value'] = $_REQUEST['parent_name'];
    $this->ev->fieldDefs['account_id_c']['value'] = $_REQUEST['parent_id'];
    }
    echo $this->ev->display();
    }
    }
    Make sure the 'account_id_c' is the correct DB field. account_id_c is created if using the Accounts module. Adjust this name based on the parent module. (ptemplin7 03/19/2008)


    Best regards,

    John

    Provident Technology Ltd
    50 Clontarf Rd
    Clontarf
    Dublin 3
    Ireland
    Ph: +353 1 4403685
    Last edited by maloner; 2008-09-01 at 11:07 AM.

  5. #5
    interfaceiberica is offline Junior Member
    Join Date
    Sep 2010
    Posts
    2

    Default Re: Inherit Team from Accounts

    Hello,

    I try to do this function and I have the next display():

    function display() {
    $this->ev->process();
    // in case of new record
    if (empty($this->ev->focus->id)) {
    if (!empty($_REQUEST['return_id'])) {

    require_once('modules/Accounts/Account.php');

    $My_bean = new Account();
    $My_bean->retrieve($_REQUEST['return_id']);

    $this->ev->fieldDefs['team_name']['value'] = $My_bean->team_name;
    $this->ev->fieldDefs['team_id']['value'] = $My_bean->team_id;
    //echo " $My_bean->team_id $My_bean->team_name";
    }
    }
    echo $this->ev->display($this->showTitle);
    }

    The field "$My_bean->team_id" returns the correct value but the problem is that result don't appear in the field 'team_id'... Can anybody help me?

  6. #6
    interfaceiberica is offline Junior Member
    Join Date
    Sep 2010
    Posts
    2

    Default Re: Inherit Team from Accounts

    Hi, nobody knows the answer?

    Finally, I found the correct solution:

    function display() {

    $this->ev->process();

    if (!empty($this->ev->fieldDefs['account_name']['value'])){

    $focus = new Contact();
    $query="select team_id,team_set_id from accounts where accounts.id = '".$this->ev->fieldDefs['account_id']['value']."'";
    $res=$focus->db->query($query);
    $row=$focus->db->fetchByAssoc($res);

    if (!empty($row)) {
    $this->ev->fieldDefs['team_id']['value'] = $row['team_id'];
    $this->ev->fieldDefs['team_set_id']['value'] = $row['team_set_id'];
    }
    }

    echo $this->ev->display($this->showTitle);
    }
    Last edited by interfaceiberica; 2010-12-13 at 10:55 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. TeamsOS 3.3
    By kbrill in forum Downloads
    Replies: 196
    Last Post: 2009-01-05, 02:33 PM
  2. Team management, security and WS-Security
    By JavaCK in forum General Discussion
    Replies: 2
    Last Post: 2008-08-26, 03:31 PM
  3. Replies: 1
    Last Post: 2006-09-11, 03:38 PM
  4. Multiple Team Memberships
    By isnceo in forum Feature Requests
    Replies: 1
    Last Post: 2005-09-27, 07:02 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
  •