> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Track responses

> How to track responses to an invitation with CRMScript

Before you can track responses, you need to fetch the main appointment and all its descendants. You can then explore the **invitation status** of each appointment.

In this example, we check and print the response for each attendee using a `String` array. You can look up status codes on the [invitations page][1].

```crmscript! theme={null}
String[15] state;
state[1] = "accepted";
state[5] = "not seen";
state[7] = "seen, but not declined or accepted";
state[9] = "declined";

Integer aId = 242;
NSAppointmentAgent appointmentAgent;

NSAppointmentEntity appointment = appointmentAgent.GetAppointmentEntity(aId);
NSAppointment[] invites = appointmentAgent.GetAppointmentRecords(aId, 0);

Integer rejects = appointment.GetRejectCounter();

if (rejects == 0) {
  printLine("There are currently no rejects.\n");
}
else {
  printLine("There are " + rejects.toString() + " rejects.\n");
}

for (Integer i = 0; i < invites.length(); i++) {
  NSAppointment a = invites[i];

  if (a.GetAppointmentId() == aId) {
    continue;
  }

  Integer s = a.GetInvitationStatus();
  if (s == 1 || s == 5 || s == 7 || s == 9) {
    printLine(a.GetAssociateFullName() + " with ID=" + a.GetAssociateId().toString() + " has " + state[s] + " the invitation.");
    if (s == 9) {
      printLine("Reason: " + a.GetRejectReason());
    }
  }
}
```

[1]: ../../../../diary/learn/invitation/index


## Related topics

- [Tracked links](/en/marketing/tracked-links/learn/index.md)
- [Track Event](/en/api/reference/restful/agent/diagnostics_agent/track-event.md)
- [Track User](/en/api/reference/restful/agent/diagnostics_agent/track-user.md)
- [Track form submissions and view statistics](/en/marketing/forms/learn/view-statistics.md)
- [Add tracked links to message](/en/marketing/editor/learn/add-tracked-link-to-msg.md)
- [Work with tracked links after the mailing](/en/marketing/tracked-links/learn/explore-clicks.md)
