Hello all
I am trying to create a new Call via custom code. This is the code:
$callAux = new Call();
$callAux->assigned_user_id=$userId;
$accountAux = new Account();
$accountAux->retrieve($accountId);
$callAux->name = "Name";
$callAux->direction='order';
$hoy = date("Y-m-d H:i:s");
$callAux->description="description";
$fecha_start = $NewDate=Date('Y-m-d 17:00:00', strtotime("+3 days"));
$fecha_end = $NewDate=Date('Y-m-d 17:15:00', strtotime("+3 days"));
// Comprobamos que la fecha no sea un fin de semana
if(date('w', strtotime($fecha_start)) == 6)
{
$fecha_start = $NewDate=Date($fecha_start, strtotime("+2 days"));
$fecha_end = $NewDate=Date($fecha_end, strtotime("+2 days"));
}
else if( date('w', strtotime($fecha_start)) == 0) {
$fecha_start = $NewDate=Date($fecha_start, strtotime("+1 days"));
$fecha_end = $NewDate=Date($fecha_end, strtotime("+1 days"));
}
$callAux->date_start =$fecha_start;
$callAux->date_end=$fecha_end;
$callAux->duration_minutes=15;
$callAux->duration_hours=0;
$callAux->status='Planned';
//SET UP REMINDERS
$callAux->reminder_time=1;
$callAux->email_reminder_time=1;
$callAux->parent_type='Accounts';
$callAux->parent_id=$accountId;
$callAux->product_related_c="pd2";
$callAux->proyecto_c='P1';
$callAux->save();
$callAux->load_relationship('accounts');
$callAux->accounts->add($accountId);
However this creates the call, but inside I get thounsands of reminders set up. In the db for this call created I get 2047 records in the reminders and reminders_invitees table.
How do I must create the call so the call only assigns a pop-up window reminder to the assigned user?
Thanks a lot!