> ## Documentation Index
> Fetch the complete documentation index at: https://superofficeas-worktree-351-fix-webapi-escaped-anchors.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Plan an outgoing call

> How to plan an outgoing call with CRMScript

The type is 5 for outgoing calls (same as incoming). However, to control the direction, you need to use the [Task MDO list table][5].

## List available task types

```crmscript theme={null}
SearchEngine se;
se.addFields("Task", "Task_id,name");
printLine(se.executeTextTable());
```

## Add call to the todo list

```crmscript theme={null}
DateTime deadline;
deadline.addDay(2);

NSAppointmentAgent appointmentAgent;
NSAppointmentEntity newCall = appointmentAgent.CreateDefaultAppointmentEntityByTypeAndAssociate(5, 1);

newCall.SetDescription("Call to book rental car");
newCall.SetAssignmentStatus(11);
newCall.SetEndDate(deadline);

NSTaskListItem task;
task.SetTaskListItemId(3);
newCall.SetTask(task);

newCall = appointmentAgent.SaveAppointmentEntity(newCall);
```

## Update when you do make the call

Parameters to [UpdateAppointment()][4]:

* appointment\_id
* start time
* end time
* status
* type
* owner (associate\_id)

```crmscript theme={null}
DateTime start;
DateTime end;
NSAppointmentAgent appointmentAgent;
appointmentAgent.UpdateAppointment(88, start, end.addMin(20), 0, 0, 5);
```

## Related topics

* [NSAppointmentAgent][1]
* [NSAppointmentEntity][2]
* [NSTaskListItem][3]
* [About phone calls][6]

[1]: /en/automation/crmscript/reference/CRMScript.NetServer.NSAppointmentAgent

[2]: /en/automation/crmscript/reference/CRMScript.NetServer.NSAppointmentEntity

[3]: /en/automation/crmscript/reference/CRMScript.NetServer.NSTaskListItem

[4]: /en/automation/crmscript/reference/CRMScript.NetServer.NSAppointmentAgent#updateappointmentintegerintegerintegerinteger

[5]: ../../../../database/tables/task

[6]: ../../../../diary/learn/follow-ups#call
