php-api icon indicating copy to clipboard operation
php-api copied to clipboard

Update Opportunity/Deal does not update 'expected_value' or 'close_date'

Open hvlucas opened this issue 8 years ago • 1 comments

Hello agilecrm php-api team,

I came across this issue when updating a Deal in my PHP Laravel 5 website. I have tried to do the same using Postman extension. "expected_value" and "close_date" does not update in Agile. This is the array which I am setting up:

        $opportunity_json = array(  
            "id" => $deal->agile_id, //It is mandatory field. Id of deal  
            "name" => $deal->name,  
            "expected_value"=>$deal->value,  
            "milestone" => $deal->milestone,  
            "close_date" => $close_date,  
            "probability"=> $deal->probability,  
            "contact_ids"=>array($agile_id, "$company->agile_id"),  
            "custom_data" => array(  
                array(  
                  "name"=>"Contract Date",  
                  "value"=>$date  
                ),  
                array(  
                  "name"=>"Contract Term",  
                  "value"=>$contract  
                ),  
                array(  
                  "name"=>"Payment Term",  
                  "value"=>$payment  
                ),  
                array(  
                  "name"=>"Sales Manager",  
                  "value"=>$manager  
                ),  
                array(  
                  "name"=>"Deal Source",  
                  "value"=>$source  
                ),  
                array(  
                  "name"=>"Setup Fee",  
                  "value"=>$deal->setup_fee  
                ),
              )
        );

Then I converted it to a readable JSON format and using the curl method.:

 $opportunity_json = json_encode($opportunity_json);
 $response = curl_wrap("opportunity/partial-update", $opportunity_json, "PUT", "application/json");

All the values have a valid value in them. I have tried using strings for the values instead of integers, that didn't work.
I also tried using Postman, using the rest-api call just with the "expected_value" or just "close_date" and both together. I am converting a regular date string into Epoch using DateTime library from PHP so I'm sure it is being converted correctly.
When I create the Deal/Opportunity, it does not have issues setting such value, it is only when I update them.
If you have anything to help me figure this out, please let me know.
Lucas

hvlucas avatar Apr 26 '17 22:04 hvlucas

Updating deal works if makes a full update vs partial-update

hvlucas avatar May 09 '17 17:05 hvlucas