Opportunity sales status value not changing correctly

Hello.

I'm using SugarCRM Enterprise 7.5.2.4.

I have a RevenueLineItems module, that is related to the Opportunities modules.

What I need is when changing the RevenueLineItem 'sales_stage' field value, the related Opportunity 'sales_status' field value changes to the same value as the 'sales_stage' field.

I already done a logic hook to do this, but when in the RevenueLineItem I select the value 'Closed Cancel', the Opportunity sales_status changes to 'Prospecting'.

I already added a 'Closed Cancel' field/value to the Opportunity sales_stage dropdown.

Why this is happening? All the other RevenueLineItens values change the Opportunity value correctly.

Does the Opportunity 'sales_status' field have some sort of calculated field value that changes the field value automatically?

Thanks.

Parents Reply Children
  • Hi Tevfik.

    I created a label with key 'Fechado Cancelado', and value 'Closed Cancel' for both 'sales_status' and 'sales_stages' dropdowns, as I indicate on this picture:

    sales_status-stage_dom.png

    When saving the RevenueLineItem, the log I put in the logic hook shows in the system the changed value. It's calling the save() function for both beans:

    $bean->name = $parentbean->name;
    $parentbean->sales_status = $bean->sales_stage;
    if ($bean->save()) {
        $GLOBALS['log']->fatal("Nome receita ".$bean->id." atualizado: ".$bean->name);
        if ($parentbean->save()) {
            $GLOBALS['log']->fatal("Status oportunidade ".$parentbean->id." atualizado: ".$parentbean->sales_status);
        } else {
            $GLOBALS['log']->fatal("Nao foi possivel editar status de oportunidade");
        }
    } else {
        $GLOBALS['log']->fatal("Nao foi possivel editar receita");
    }
    

    But when checking the Opportunity sales status value, it's still with 'Prospecting' value.

    Does this condition only applies to 'Prospecting', 'Closed Won', and 'Closed Lost'?
    That's because they are already default values in these dropdowns?

    Seeing by the response on a  similar case I opened with another account in the Sugar Enterprise Support, the logic only applies to the default values?

    https://web.sugarcrm.com/support/cases/5279bb73-ae00-6310-fe7e-573dbeb5ca91 

    Best Regards,

    Ramon