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

# Samples

> Sample code for working with projects in CRMScript.

## List available project types

```crmscript! theme={null}
SearchEngine se;
se.addFields("ProjType", "ProjType_id,name");
print(se.executeTextTable());
```

## Get an updated list of statuses

```crmscript! theme={null}
NSListAgent listAgent;
NSProjectStatus[] statuses = listAgent.GetProjectStatuses();

foreach (NSProjectStatus s in statuses) {
  printLine(s.GetId().toString() + " " + s.GetValue());
}
```

Or:

```crmscript! theme={null}
SearchEngine se;
se.addFields("ProjStatus", "ProjStatus_id,name");
print(se.executeTextTable());
```

## Check if project is connected to a guide

```crmscript! theme={null}
NSProjectAgent agent;
NSListAgent listAgent;

NSProjectEntity p = agent.GetProjectEntity(4);
NSProjectTypeEntity type = listAgent.GetProjectTypeEntity(p.GetProjectType().GetId());

if (type.GetHasGuide()) {
  printLine("This project has a guide!");
}
else {
  printLine("This project does not have a guide.");
}
```

<Note>
  `GetProjectType()` returns an NSProjectType object, while you need an NSProjectTypeEntity object to call `GetHasGuide()`. You can use the list agent to do the "conversion".
</Note>


## Related topics

- [Samples](/en/automation/crmscript/howto/sale/samples.md)
- [TicketStaticSelectionV2](/en/api/archive-providers/reference/ticketstaticselectionv2.md)
- [TicketTransferredNotification](/en/api/archive-providers/reference/tickettransferrednotification.md)
- [TimeZones](/en/api/archive-providers/reference/timezones.md)
