Setting New Opportunity Revenue Line Item Assigned To and Teams

When creating a new Opportunity (Opp), the Revenue Line Item (RLI) is also created at the same time. Currently, the RLI Assigned To and Teams are set to the values of the person creating the records, but we would like the RLI Assigned To and Teams to be equal to the Opportunity Assigned To and Teams. We'd only like this on initial RLI Creation because we'd like to have the ability to change it and make it different, if needed, later. 

I was thinking of a SugarBPM process initiated on a new RLI Record Creation, but I can't seem to find the right way to set the RLI Assigned To and Teams fields to the values in the Opportunity. 

Maybe there's an entirely different way to do this, but we are new at Sugar and haven't done much in the customization way other than some SugarLogic formulas for fields and very rudimentary SugarBPM processes. 

Thanks for any help!

Parents
  • As Adam said it is not possible to configure that via Sugar BPM, instead you may create a Dependency SetValue in order to populate team_id, team_set_id and assigned_user_id on RLI as per respective values on Opportunity. Under a Dependency you can even choose to trigger such action only on creating a RLI, that means, when its ID is empty.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Sounds promising. Is there some documentation on how to develop and deploy a Dependency SetValue? Sort of sounds like SugarLogic, but I'm still learning here. Thanks for the help!

  • If there are more customizations, or if you're looking at coding anyways, another option is to use logic_hooks. Just leaving it here in case it helps you/others:

    <?php
    
    class CopyTeamAssignedUserHook
    {
        function execute($bean, $event, $arguments)
        {
            if (empty($bean->fetched_row) &&    // Do this only for new records
                !empty($bean->opportunity_id))  // Ensure there is an opportunity
            {
                $opportunity = BeanFactory::getBean('Opportunities', $bean->opportunity_id);
                $bean->assigned_user_id = $opportunity->assigned_user_id;
                $bean->team_id = $opportunity->team_id;
                $bean->team_set_id = $opportunity->team_set_id;
            }
        }
    }  

    This logic hook will go into the RevenueLineItems module, as you know already.

    This link explains how to install logic hooks for packages:https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.1/Cookbook/Module_Loadable_Packages/Creating_an_Installable_Package_for_a_Logic_Hook/

  • I took a shot at building the installable package for the above customization. If someone had a chance to review it, as this is the first I've built, that would be awesome. I took the structure of the package from the Creating an Installable Package for a Logic Hook > https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.1/Cookbook/Module_Loadable_Packages/Creating_an_Installable_Package_for_a_Logic_Hook/ 

    rli_copy_opportunity_team_assigned_logic_hook.zip

  • Hi Vince,

    After having a quick glance I believe you are good to deploy and test it. Please upload the zip package in sandbox environment, test and move ahead. :)

  • Hi Vince, 

    just to make it simple: The MAC is a big messi when it comes to creation of zip-files.

    1st, your zip file must have the manifest.php and the Files directory in the root directory. In your file you find the directory rli_copy_opportunity_team_assigned_logic_hook and the typical MAC garbage __MACOS. 

    2nd there is a file .DS_store in nearly each directory, again MAC garbage which must be removed.

    3rd: A LICENSE file should be added, even if it contains only empty lines.

    When you zip your installable it should contain the following files and nothing else:

    Fullscreen
    1
    2
    3
    4
    \manifest.php
    \LICENSE
    \Files\custom\Extension\RevenueLineItems\Ext\LogicHooks\rli_copy_opportunity_team_assigned_to_hook.php
    \Files\custom\modules\RevenueLineItems\rli_copy_opportunity_team_assigned_to.php
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Related to the manifest file, I would use 

    'acceptable_sugar_versions' => array('9.*.*','10.*.*'),

    which is not the univeral unlocker like the regex. RLIs exist not since the beginning of Sugar.

    SugarFlavor CE will not work witj RLIs and is not supported any more.

    Lastly, your name is very long, This name is used to create some file names during installation. So it could happen, if the file system of the target machine has issues with long filenames (like Windows has), your function will be installed but will not run correctly.

    I always use the same strings for name and id and try to make them short and simple.

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

  • FYI this is the command i use to zip my files on a Mac and avoid including the system-generated files:

    Fullscreen
    1
    zip -r --filesync ../packages/my_mlp_name.zip * -x "*.DS_Store" -x "*.git*" -x "__MAC*"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Reply
  • FYI this is the command i use to zip my files on a Mac and avoid including the system-generated files:

    Fullscreen
    1
    zip -r --filesync ../packages/my_mlp_name.zip * -x "*.DS_Store" -x "*.git*" -x "__MAC*"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Children
No Data