Auto populate note / task name with Opportunity name

When creating a note / task from a subpanel in Opportunities, is it possible to pre-populate the name of note / task with the name of the opportunity? This needs to work on mobile as well, so I can't do it in javascript (I don't think at least). If I make the name field a calculated field to be a related($opportunities, "name"), it works after the save. I need the user to be able to see it and change it if necessary. So essentially I need a way to type in the name for the user. Is this possible? I've spent a while trying a few things, nothing has been successful. 

Parents
  • Hi Ryan Horton 

    It is possible to make it work even on mobile.

    You have to:

    • create the field opp_name in Tasks and Notes
    • Configure the attribute populate_list in the field definition of tasks and notes at module Opportunities (take a look at the field contacts in the vardefs of Opportunities module)
    • Define a SugarLogic formula for calculating the name of Task and Note accordingly

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi Ryan Horton,

    I did something similiar with the Opportunity name some time ago.

    My scenario:

    On creating an Opportunity, a shortname of the linked account should be prefilled in the opps name field but let the user be able to add the name of the opportunity.

    It works like this:

    1.

    I placed this formula in the opps name field in studio, making sure it will be set regardless of the "short name" is given or not:

    ifElse(or(equal($name,"undefined - "),equal($name,"")),ifElse(greaterThan(strlen(related($accounts,"account_name_short_c")),0),concat(related($accounts,"account_name_short_c")," - "),""),$name)

    2. Do give the user access to the calculated field to alter the content I added this

    $dictionary['Opportunity']['fields']['name']['enforced'] = false;

    to

    custom/Extension/modules/Opportunities/Ext/Vardefs/sugarfield_name.php

    3. This may be optional but in some cases it appeared that the opps got the same name and the users complained about the appearing duplicate check so we turned it off for opps by creating a new file in vardefs:

    1.Create \custom\Extension\modules\Opportunities\Ext\Vardefs\sugarfield_cancel_duplicate_check.php (The name of this file can be changed to else as you wish). And add the following code.

    <?php
    $dictionary['Opportunity']['duplicate_check']['enabled']=false;
     ?>

    2.Do quick-repair & Rebuild.

    To be honest I have not tried if this works on mobile and are currently not able to do it quickly.

    Best regards

    Björn

Reply
  • Hi Ryan Horton,

    I did something similiar with the Opportunity name some time ago.

    My scenario:

    On creating an Opportunity, a shortname of the linked account should be prefilled in the opps name field but let the user be able to add the name of the opportunity.

    It works like this:

    1.

    I placed this formula in the opps name field in studio, making sure it will be set regardless of the "short name" is given or not:

    ifElse(or(equal($name,"undefined - "),equal($name,"")),ifElse(greaterThan(strlen(related($accounts,"account_name_short_c")),0),concat(related($accounts,"account_name_short_c")," - "),""),$name)

    2. Do give the user access to the calculated field to alter the content I added this

    $dictionary['Opportunity']['fields']['name']['enforced'] = false;

    to

    custom/Extension/modules/Opportunities/Ext/Vardefs/sugarfield_name.php

    3. This may be optional but in some cases it appeared that the opps got the same name and the users complained about the appearing duplicate check so we turned it off for opps by creating a new file in vardefs:

    1.Create \custom\Extension\modules\Opportunities\Ext\Vardefs\sugarfield_cancel_duplicate_check.php (The name of this file can be changed to else as you wish). And add the following code.

    <?php
    $dictionary['Opportunity']['duplicate_check']['enabled']=false;
     ?>

    2.Do quick-repair & Rebuild.

    To be honest I have not tried if this works on mobile and are currently not able to do it quickly.

    Best regards

    Björn

Children