Create alternatives
•
Version: 10
Some tooltip text!
• 1 minute to read
• 1 minute to read
NSQuoteAlternative CreateDefaultQuoteAlternative()
Creates an alternative with default values.
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.
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.
NSQuoteAgent qa;
NSQuoteAlternative alt = qa.CopyQuoteAlternative(1, 2,"plan c");
// modify quote lines
alt = qa.SaveQuoteAlternative(alt);
Set alternatives
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.