> ## 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.

# View recurrence info of a follow-up

> How to get recurrence info with CRMScript

Depending on the level details you need, you can use either the [NSAppointment][1] or the [NSAppointmentEntity][2] class.

## Basic info (NSAppointment)

```crmscript! theme={null}
Integer aId = 234;
NSAppointmentAgent appointmentAgent;
NSAppointment a = appointmentAgent.GetAppointment(aId);

if (a.GetIsRecurrence()){
  Integer pattern = a.GetRecurringPattern();
  DateTime start = a.GetRecurringStartDate();
  printLine("Follow-up " + aId.toString() + " is recurring. Pattern: " +pattern.toString() + "\tStart: " + start.toString());
}
```

## Complex info (NSAppointmentEntity, NSRecurrenceInfo)

```crmscript! theme={null}
Integer aId = 234;
Integer pattern = 0;
Integer subPattern = 0;
Integer endType = 0;
Integer count = 0;

DateTime start;
DateTime end;

NSAppointmentAgent appointmentAgent;
NSAppointmentEntity a = appointmentAgent.GetAppointmentEntity(aId);

NSRecurrenceInfo recurrenceInfo = a.GetRecurrence();

if (recurrenceInfo.GetIsRecurrence()) {
  start = recurrenceInfo.GetStartDate();
  pattern = recurrenceInfo.GetPattern();
  endType = recurrenceInfo.GetRecurrenceEndType();

  if (pattern == 1) {
    subPattern = recurrenceInfo.GetDayPattern().GetPattern();
  }
  else if (pattern == 2) {
    subPattern = recurrenceInfo.GetWeekPattern().GetCycle();
  }
  else if (pattern == 3) {
    subPattern = recurrenceInfo.GetMonthPattern().GetPattern();
  }
  else if (pattern == 4) {
    subPattern = recurrenceInfo.GetYearPattern().GetPattern();
  }

  if (endType == 1) {
    end = recurrenceInfo.GetEndDate();
  }
  else if (endType == 2) {
    count = recurrenceInfo.GetRecurrenceCounter();
  }

  printLine("Follow-up " + aId.toString() + " is recurring.\nPattern: " + pattern.toString() + "\tSub-pattern: " + subPattern.toString());
  printLine("Start: " + start.toString() + "\nEnd: " + end.toString());
}
```

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

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


## Related topics

- [Create repeating follow-ups](/en/automation/crmscript/howto/diary/create-recurring-appointment.md)
- [Follow-ups](/en/diary/learn/follow-ups.md)
- [Add follow-up](/en/diary/learn/create-follow-up.md)
- [Schedule repeating follow-up](/en/diary/learn/recurrence/create.md)
- [Edit follow-up](/en/diary/learn/edit-follow-up.md)
- [Move a follow-up](/en/diary/learn/move-follow-up.md)
