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

# Create alternatives

> How to create a quote alternative with CRMScript.

## NSQuoteAlternative CreateDefaultQuoteAlternative()

Creates an alternative with default values.

```crmscript theme={null}
NSQuoteAgent qa;
NSQuoteAlternative alt = qa.CreateDefaultQuoteAlternative();
alt.SetName("plan a");
alt.SetQuoteVersionId(1);

// add quote lines

alt = qa.SaveQuoteAlternative(alt);
```

## NSQuoteAlternative CreateQuoteAlternative(Integer quoteVersionId, String quoteAlternativeName, String quoteAlternativeDescription)

Creates an alternative for a specific version.

```crmscript theme={null}
NSQuoteAgent qa;
NSQuoteAlternative alt = qa.CreateQuoteAlternative(1,"plan b","optimized for home office");

// add quote lines

alt = qa.SaveQuoteAlternative(alt);
```

## NSQuoteAlternative CopyQuoteAlternative(Integer quoteVersionId, Integer quoteAlternativeId, String quoteAlternativeName)

A variant of `CreateQuoteAlternative()` that clones an alternative into the new one. This is an efficient way of creating multiple alternatives with small variations.

```crmscript theme={null}
NSQuoteAgent qa;
NSQuoteAlternative alt = qa.CopyQuoteAlternative(1, 2,"plan c");

// modify quote lines

alt = qa.SaveQuoteAlternative(alt);
```

## Set alternatives

```crmscript theme={null}
NSQuoteAgent qa;

NSQuoteAlternative[] alternatives;

// populate array

NSQuoteVersion version = qa.GetQuoteVersion(1);
version.SetQuoteAlternatives(alternatives);
qa.SaveQuoteVersion(1);
```

## Reference

### Frequently used QuoteAlternative fields

| Field                | Description                            |
| :------------------- | :------------------------------------- |
| quotealternative\_id | ID                                     |
| QuoteVersionId       | the version the alternative belongs to |
| Name                 | label for UI                           |
| VAT                  | as calculated amount                   |
| EarningPercent       | in percent of total                    |
| EarningAmount        | as amount                              |
| TotalPrice           | calculated                             |

For a complete list of fields, see the [database reference][2].

[2]: ../../../../database/tables/quotealternative
