Results 1 to 6 of 6

Thread: Auto calculate "Amount "Field" in Opportunities

  1. #1
    grecstar is offline Member
    Join Date
    Jun 2009
    Posts
    13

    Default Auto calculate "Amount "Field" in Opportunities

    Hello, I'd like to create a default value for the required Amount field in Opportunities by multiply a custom field by an integer. Any idea how to go about this? I have access to php files etc. but am an extreme newb
    thanks

  2. #2
    crmbalah is offline A Prolific Poster
    Join Date
    Mar 2009
    Location
    chennai
    Posts
    418

    Default Re: Auto calculate "Amount "Field" in Opportunities

    Hi
    you can set default value to "Amount field" through view.edit
    and you can calculate and assign the value to custom file through this view.edit

  3. #3
    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: Auto calculate "Amount "Field" in Opportunities

    Actually the best place to do that is the controller.
    Create the script custom/modules/Opportunities/controller.php containing something like that:

    PHP Code:
    <?php
    require_once('include/MVC/Controller/SugarController.php');

    class 
    OpportunitiesController extends SugarController{
        function 
    action_editview() {
            
    $this->view 'edit';
            
    $this->bean->amount '<some pre defined value>';
        }
    }
    ?>
    Cheers
    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.

  4. #4
    lougaou's Avatar
    lougaou is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Lyon - France
    Posts
    236

    Default Re: Auto calculate "Amount "Field" in Opportunities

    Personnaly i will do it via a logick hook before_save like that the field with be calculated via SugarCRM UI, via Import and via any external action (SOAP)
    Controllers lets you do it only via sugarCRM UI.
    --------------------
    Xavier Rigal

  5. #5
    grecstar is offline Member
    Join Date
    Jun 2009
    Posts
    13

    Default Re: Auto calculate "Amount "Field" in Opportunities

    Quote Originally Posted by andopes View Post
    Actually the best place to do that is the controller.
    Create the script custom/modules/Opportunities/controller.php containing something like that:

    PHP Code:
    <?php
    require_once('include/MVC/Controller/SugarController.php');

    class 
    OpportunitiesController extends SugarController{
        function 
    action_editview() {
            
    $this->view 'edit';
            
    $this->bean->amount '<some pre defined value>';
        }
    }
    ?>
    Cheers
    OK, I tried this method (because it gave me the exact syntax) and it works for the Opportunities Edit view, but not creating a new Opportunity or most importantly Creating an Opportunity from Convert Lead.
    thanks for responses

  6. #6
    sandeeplakshmi is offline Sugar Community Member
    Join Date
    Apr 2008
    Location
    bangalore,India
    Posts
    20

    Default Re: Auto calculate "Amount "Field" in Opportunities

    Hello grecstar!!

    if you want amount default in the ConvertLead page you need to do a small change for the IF condition in the file 'OpportunityFormBase.php' under the function "getWideFormBody"

    old :
    if (isset($lead->opportunity_amount)) {
    $opp_amount=$lead->opportunity_amount;
    } else {
    $opp_amount='';
    }

    new :
    if (isset($lead->your_field)) {
    $opp_amount=$lead->your_field; { any thing you can multiply here }
    } else {
    $opp_amount='';
    }


    this will prefill your 'amount' with the custom value.


    - Sandeep Lakshmi
    Be Hungry!! Be Foolish!!!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 2009-12-18, 05:52 PM
  2. 5.2 CE, "Amount" not required in "Opportunities"
    By bachNroll7 in forum Developer Help
    Replies: 5
    Last Post: 2009-03-31, 10:44 PM
  3. Replies: 0
    Last Post: 2007-07-27, 08:13 AM
  4. Replies: 0
    Last Post: 2005-03-03, 06:58 PM
  5. Replies: 1
    Last Post: 2005-03-03, 05:36 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
  •