Omitir navegación
Ampliar
  • Búsqueda avanzadaAbre un nuevo diálogo
    Ingrese los signos mas (+) o menos (-) en los términos de búsqueda para incluir o excluir la palabra requerida
    Consejos de búsqueda
    Filtrar por producto
    Filtrar por categoría
Incident contact set to null when contact is deleted via API
ID de respuesta 12209   |   Revisado 02/05/2022

Why weren't the incidents associated with a contact deleted when the contact was deleted?

Environment:
  • Oracle B2C Service version 21D and later
  • Connect for PHP API
  • Connect REST API
  • Connect Web Services for SOAP (CWSS) API
Issue:
 
Instead of being deleted, incidents associated to a contact have their primary contact asynchronously unassigned after the contact is deleted via public APIs. Similarly, when an organization is deleted, associated contacts are not deleted.
 
Resolution:
 
The incidents associated to a contact are not deleted when the contact is deleted through API calls. The agedatabase-O utility instead unassigns the contact from all incident records when it runs by setting the contact ID to null.
 
If you are deleting a contact from a script, prior to deletion of the contact you can make any necessary changes to the incident. Following is a sample snippet of PHP code that could be used as a starting point.
 
<?
//...
use RightNow\Connect\v1_4 as RNCPHP;
//...
try {
  $incidents = array();
  $contact = RNCPHP\Contact::fetch(1234);
  $res = RNCPHP\ROQL::query("SELECT I.ID FROM Contact INNER JOIN Contact.PrimaryContactIncidents I WHERE Contact.ID = " . $contact->ID)->next();
  while ($i_id = $res->next()['ID']) {
    $incidents[] = RNCPHP\Incident::fetch($i_id);
    end($incidents)->destroy(RNCPHP\RNObject::SuppressAll);
  }
  $contact->destroy(RNCPHP\RNObject::SuppressAll);
} catch (\Exception $err) {
  die($err->getMessage());
}
 
Notes:
 
You can check the status of this utility following the instructions in the answer How to check utility status for my site.
 
Immediately after the contact has been deleted, the contact ID on an incident will show as null through the Connect PHP API even though the value has not truly been cleared until the utility runs. The utility may take some time to null out the id depending on how many objects are deleted.  Opening an incident that is no longer associated to a contact may produce an error therefore all incidents, or other child objects, should be handled as in the above code before deleting the contact or other parent object. 
 
The sample code in this document or accessed through this document is not certified or supported by Oracle. It is intended for educational or testing purposes only. Use of this sample code implies acceptance of the License Agreement.
Notificarme
La página se refrescará al enviar. Las entradas pendientes se perderán.