UpdateRecord

Allows you to update a Record.
 

PHP

//Search for task to update

$taskRef = new StdClass();

$taskRef->Type = 'TASK';

$taskRef->Id = 3523;

$getTaskRequest = new StdClass();

$getTaskRequest->credentials = $credentials;

$getTaskRequest->recordRef = $taskRef;

$response = $service->GetRecord($getTaskRequest);

$record = $response->record;

if (!isset ($record)){

    echo "Task not found<br/>";

    return;

}

$task = $record;

//Since PHP uses StdClass, propertyValue must be reencoded in string.

if (isset($task->Metas)){

   foreach ($task->Metas->Property as $property){

      $property->Value = new SoapVar($property->Value, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');

   }

}

//Since PHP uses StdClass, propertyValue must be reencoded in string.

if (isset($task->Properties)){

   foreach ($task->Properties->Property as $property){

      $property->Value = new SoapVar($property->Value, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');

   }

}

if (isset($task->TaskItemList) ){

    //Since PHP uses StdClass, TaskItem and TaxAmount must be reencoded.

   if (isset ($task->TaskItemList->TaskItems) && isset ($task->TaskItemList->TaskItems->Record)){

      foreach ($task->TaskItemList->TaskItems->Record as &$item)

         $item = new SoapVar($item, SOAP_ENC_OBJECT, 'TaskItem', "http://task.v1.ws.progression.diffusion.cc");        

    }

    if (isset($task->TaskItemList->TaxAmounts) && isset($task->TaskItemList->TaxAmounts->Record)){

        foreach ($task->TaskItemList->TaxAmounts->Record as &$tax)

            $tax = new SoapVar($tax, SOAP_ENC_OBJECT, 'TaxAmount', "http://task.v1.ws.progression.diffusion.cc");

    }

}

$task->Summary = 'New Summary';

$task->Description = 'New Description';

$updateRequest = new StdClass();

$updateRequest->credentials = $credentials;

$updateRequest->record = new SoapVar($task, SOAP_ENC_OBJECT, 'Task', "http://task.v1.ws.progression.diffusion.cc");

try {

    $reponse = $service->UpdateRecord($updateRequest);

} catch (Exception $e){

}