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

# Recalculate Quote Alternative

> When the user changes one or more values in a quoteline or a quoteAlternative, the connector gets to change the QuoteLines and the alternative, for instance calculate VAT.

RecalculateQuoteAlternative shall be called when the user changes any of the following fields: Quantity, DiscountAmount, DiscountPercent, listprice (if allowed). RecalculateQuoteAlternative will calculate the TotalPrice and the VAT (if possible) for the lines and the alternative.
NsApiSlow threshold: 5000 ms.



## OpenAPI

````yaml /openapi/agent/openapi-v3-QuoteAgent.json post /api/v1/Agents/Quote/RecalculateQuoteAlternative
openapi: 3.0.0
info:
  version: v1-Agents
  title: SuperOffice Agent API v1
  description: SuperOffice Agent API - QuoteAgent
  contact:
    name: SuperOffice DevNet
    url: https://docs.superoffice.com/en/api/index.html
    email: sdk@superoffice.com
servers:
  - url: http://localhost:56350
  - url: https://localhost:56350
security: []
tags: []
externalDocs:
  description: >-
    The SuperOffice DevNet Community has more documentation, examples, and
    discussion forums.
  url: https://community.superoffice.com/en/developer/
paths:
  /api/v1/Agents/Quote/RecalculateQuoteAlternative:
    post:
      tags:
        - Quote_Agent
      summary: Recalculate Quote Alternative
      description: "When the user changes one or more values in a quoteline or a quoteAlternative, the connector gets to change the QuoteLines and the alternative, for instance calculate VAT.\n\nRecalculateQuoteAlternative shall be called when the user changes any of the following fields: Quantity, DiscountAmount, DiscountPercent, listprice (if allowed). RecalculateQuoteAlternative will calculate the TotalPrice and the VAT (if possible) for the lines and the alternative.\r\nNsApiSlow threshold: 5000 ms."
      operationId: v1QuoteAgent_RecalculateQuoteAlternative
      parameters:
        - name: $select
          in: query
          description: >-
            Optional comma separated list of properties to include in the
            result. Other fields are then nulled out to reduce payload size:
            "Name,department,category". Default = show all fields.
          required: false
          schema:
            type: string
        - name: Accept-Language
          in: header
          description: >-
            Convert string references and multi-language values into a specified
            language (iso2) code.
          required: false
          schema:
            type: string
        - name: SO-Language
          in: header
          description: >-
            Convert string references and multi-language values into a specified
            language (iso2) code. Overrides Accept-Language value.
          required: false
          schema:
            type: string
        - name: SO-Culture
          in: header
          description: >-
            Number, date formatting in a specified culture (iso2 language) code.
            Partially overrides SO-Language/Accept-Language value. Ignored if no
            Language set.
          required: false
          schema:
            type: string
        - name: SO-TimeZone
          in: header
          description: >-
            Specify the timezone code that you would like date/time responses
            converted to.
          required: false
          schema:
            type: string
        - name: SO-AppToken
          in: header
          description: >-
            The application token that identifies the partner app. Used when
            calling Online WebAPI from a server.
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.QuoteCarriers.RecalculateQuoteAlternativeRequest
          text/json:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.QuoteCarriers.RecalculateQuoteAlternativeRequest
          application/xml:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.QuoteCarriers.RecalculateQuoteAlternativeRequest
          text/xml:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.QuoteCarriers.RecalculateQuoteAlternativeRequest
          application/x-www-form-urlencoded:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.QuoteCarriers.RecalculateQuoteAlternativeRequest
          application/json-patch+json:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.QuoteCarriers.RecalculateQuoteAlternativeRequest
          application/merge-patch+json:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.QuoteCarriers.RecalculateQuoteAlternativeRequest
        description: QuoteAlternative
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/SuperOffice.CRM.Services.QuoteAlternativeRecalculated
            text/json:
              schema:
                $ref: >-
                  #/components/schemas/SuperOffice.CRM.Services.QuoteAlternativeRecalculated
            application/xml:
              schema:
                $ref: >-
                  #/components/schemas/SuperOffice.CRM.Services.QuoteAlternativeRecalculated
            text/xml:
              schema:
                $ref: >-
                  #/components/schemas/SuperOffice.CRM.Services.QuoteAlternativeRecalculated
            application/json-patch+json:
              schema:
                $ref: >-
                  #/components/schemas/SuperOffice.CRM.Services.QuoteAlternativeRecalculated
            application/merge-patch+json:
              schema:
                $ref: >-
                  #/components/schemas/SuperOffice.CRM.Services.QuoteAlternativeRecalculated
      security:
        - SuperOffice_Password: []
          SuperId_Authentication: []
components:
  schemas:
    SuperOffice.WebApi.v1.Carriers.QuoteCarriers.RecalculateQuoteAlternativeRequest:
      description: >-
        RecalculateQuoteAlternative: When the user changes one or more values in
        a quoteline or a quoteAlternative, the connector gets to change the
        QuoteLines and the alternative, for instance calculate VAT.
        RecalculateQuoteAlternative shall be called when the user changes any of
        the following fields: Quantity, DiscountAmount, DiscountPercent,
        listprice (if allowed). RecalculateQuoteAlternative will calculate the
        TotalPrice and the VAT (if possible) for the lines and the alternative.
      type: object
      properties:
        QuoteAlternative:
          format: int32
          type: integer
    SuperOffice.CRM.Services.QuoteAlternativeRecalculated:
      description: "The QuoteAlternativeRecalculated is returned after a call to RecalculateQuoteAlternative. It contains flags indicating changes to quote alternative and quote lines.\r\n<para />\r\nCarrier object for QuoteAlternativeRecalculated.\r\nServices for the QuoteAlternativeRecalculated Carrier is available from the <see cref=\"T:SuperOffice.CRM.Services.IQuoteAgent\">Quote Agent</see>."
      type: object
      properties:
        QuoteLinesHasChanged:
          description: If true any of the quotelines for the alternative has been changed.
          type: boolean
        ChangedQuoteAlternative:
          $ref: '#/components/schemas/SuperOffice.CRM.Services.QuoteAlternative'
        Changes:
          $ref: '#/components/schemas/SuperOffice.CRM.Services.ChangedData'
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Services.QuoteAlternative:
      description: "Information about a connection to the ERP system.\r\n<para />\r\nCarrier object for QuoteAlternative.\r\nServices for the QuoteAlternative Carrier is available from the <see cref=\"T:SuperOffice.CRM.Services.IQuoteAgent\">Quote Agent</see>."
      type: object
      properties:
        QuoteAlternativeId:
          format: int32
          description: Primary key
          type: integer
        ERPQuoteAlternativeKey:
          description: >-
            Key that identifies this alternative in the ERP system, if it exists
            there.
          type: string
        QuoteVersionId:
          format: int32
          description: >-
            The version that owns this alternative (the chain is Sale 1->1 Quote
            1->+ QuoteVersion 1->+ QuoteAlternative.
          type: integer
        Name:
          description: >-
            Name of Alternative. Shown in tab in user interface, intentionally
            kept short
          type: string
        Description:
          description: >-
            The tool-tip to use in the user interface (on the tab, for
            instance).
          type: string
        Status:
          description: >-
            If there was a problem with for instance calculation, this field is
            set to warning or error.
          enum:
            - Ok
            - OkWithInfo
            - Warning
            - Error
          type: string
        Reason:
          description: >-
            If there was a problem, this field contains a localized explanation
            of the problem and possible steps to fix it that the user can be
            shown.
          type: string
        ERPDiscountPercent:
          format: double
          description: >-
            The discount the system calculates based on customer /amount /
            whatever. Can be overridden by the sales rep in the field
            ‘DiscountPercent’ or ‘DiscountAmount’. Both the two
            ‘ERPDiscountPercent’ and ‘ERPDiscountAmount’ shall be filled out. If
            UserValueOverride is 'None', then the ERPDiscountAmount shall be
            copied into DiscountAmount and ERPDiscountPercent into
            DiscountPercent. The Percentage is given in integer form, i.e. ‘12%’
            is represented as ‘12’.
          type: number
        ERPDiscountAmount:
          format: double
          description: >-
            The discount the system calculates based on customer /amount /
            whatever. Can be overridden by the user in the field
            ‘DiscountPercent’ or ‘DiscountAmount’. Both the two
            ‘ERPDiscountPercent’ and ‘ERPDiscountAmount’ shall be filled out. If
            UserValueOverride is 'None', then the ERPDiscountAmount shall be
            copied into DiscountAmount and ERPDiscountPercent into
            DiscountPercent.
          type: number
        DiscountPercent:
          format: double
          description: >-
            The discount the sales rep specifies, in percent. Both the two
            ‘DiscountPercent’ and ‘DiscountAmount’ shall be filled out, but the
            UserValueOverride field must be set to the field the user actually
            changed. If this field is filled out by the user, it overrides the
            discount suggested by the connector. If the user has not filled any
            values, the system will copy the ERP discount percent value into
            this field. The Percentage is given in integer form, i.e. ‘12%’ is
            represented as ‘12’.
          type: number
        DiscountAmount:
          format: double
          description: >-
            The discount the sales rep specifies, in whatever currency the sale
            is in. Both the two ‘DiscountPercent’ and ‘DiscountAmount’ shall be
            filled out, but the UserValueOverride field must be set to the field
            the user actually changed. If this field is filled out by the user,
            it overrides the discount suggested by the connector. If the user
            has not filled any values, the system will copy the ERP discount
            amount value into this field.
          type: number
        UserValueOverride:
          description: >-
            Has the pre-calculated (from ERP) price information been overridden,
            and how. If the user has filled out the discountpercentage field,
            then the UserValueOverride field is set to OverridePercent. (The
            DiscountAmount, EarningPercent, EarningAmount and TotalPrice fields
            are calculated based on the discountPercent.)
          enum:
            - None
            - Total
            - DiscountPercent
            - DiscountAmount
            - EarningPercent
            - EarningAmount
          type: string
        VATInfo:
          description: >-
            Extra info about VAT that the connector might insert. This field has
            no business logic in the CRM code, but is available as a merge field
            in the quote documents.
          type: string
        VAT:
          format: double
          description: >-
            Tax/VAT - THIS IS AN AMOUNT, available as a merge field in the quote
            document. The SuperOffice quote connector will calculate this field
            based on the vat PERCENTAGES on the individual lines; other
            connectors may implement other algorithms at will.
          type: number
        EarningPercent:
          format: double
          description: >-
            The earning on this alternative, in percent of total. The Percentage
            is given in integer form, i.e. ‘12%’ is represented as ‘12’.
          type: number
        EarningAmount:
          format: double
          description: Earning on this alternative, as an absolute amount
          type: number
        SubTotal:
          format: double
          description: >-
            Value to help the user interface, is computed by summing the
            totalprice of the quotelines, and NOT by summing their subtotals
          type: number
        TotalPrice:
          format: double
          description: >-
            Sum of the QuoteLines.TotalPrice - AlternativeDiscount or
            QuoteLines.TotalCost + Earning based on what, if anything, the user
            has entered last. Shall be calculated by the connector.
          type: number
        ExtraField1:
          description: >-
            Optional information added by Quote Connector; usable in the quote
            document merge process
          type: string
        ExtraField2:
          description: >-
            Optional information added by Quote Connector; usable in the quote
            document merge process
          type: string
        ExtraField3:
          description: >-
            Optional information added by Quote Connector; usable in the quote
            document merge process
          type: string
        ExtraField4:
          description: >-
            Optional information added by Quote Connector; usable in the quote
            document merge process
          type: string
        ExtraField5:
          description: >-
            Optional information added by Quote Connector; usable in the quote
            document merge process
          type: string
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Services.ChangedData:
      description: "Generic carrier, used in return values to indicate what data NetServer has changed 'behind the scenes' so clients can know what to update\r\n<para />\r\nCarrier object for ChangedData.\r\nServices for the ChangedData Carrier is available from the <see cref=\"T:SuperOffice.CRM.Services.IQuoteAgent\">Quote Agent</see>."
      type: object
      properties:
        AddedRecords:
          description: Ids of added records.
          type: array
          items:
            $ref: '#/components/schemas/SuperOffice.CRM.Services.ChangedDataItem'
        UpdatedRecords:
          description: Ids of updated records.
          type: array
          items:
            $ref: '#/components/schemas/SuperOffice.CRM.Services.ChangedDataItem'
        DeletedRecords:
          description: Ids of deleted records.
          type: array
          items:
            $ref: '#/components/schemas/SuperOffice.CRM.Services.ChangedDataItem'
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Security.TableRight:
      description: "Wraps a table right together with an explanatory reason.\r\nCode can indicate why access is restricted."
      type: object
      properties:
        Mask:
          type: string
        Reason:
          type: string
    SuperOffice.CRM.Security.FieldProperty:
      description: >-
        Class holding properties like field length, field type about a field in
        the carrier.
      type: object
      properties:
        FieldRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldRight'
        FieldType:
          type: string
        FieldLength:
          format: int32
          description: ''
          type: integer
    SuperOffice.CRM.Services.ChangedDataItem:
      description: "Tablename/recordid pair used to refer to records\r\n<para />\r\nCarrier object for ChangedDataItem.\r\nServices for the ChangedDataItem Carrier is available from the <see cref=\"T:SuperOffice.CRM.Services.IQuoteAgent\">Quote Agent</see>."
      type: object
      properties:
        Tablename:
          description: Name of table, standardized to lowercase
          type: string
        RecordId:
          format: int32
          description: Id of record, should never be 0
          type: integer
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Security.FieldRight:
      description: "Wraps the field right together with an explanatory reason.\r\nAlso adds logical operators to the field rights so that they can be easily combined."
      type: object
      properties:
        Mask:
          type: string
        Reason:
          type: string

````

## Related topics

- [NSQuoteAlternativeRecalculated](/en/automation/crmscript/reference/CRMScript.NetServer.NSQuoteAlternativeRecalculated.md)
- [SuperOffice.WebApi.Data.Quote RecalculateQuoteAlternativeRequest](/en/api/reference/webapi/SuperOffice.WebApi.Data.Quote_RecalculateQuoteAlternativeRequest.md)
- [NSQuoteAgent](/en/automation/crmscript/reference/CRMScript.NetServer.NSQuoteAgent.md)
- [SuperOffice.WebApi.Data.QuoteAlternativeRecalculated](/en/api/reference/webapi/SuperOffice.WebApi.Data.QuoteAlternativeRecalculated.md)
- [IQuoteConnector](/en/api/plugins/quote-connectors/api/iquoteconnector.md)
- [SuperOffice.WebApi.Agents.QuoteAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.QuoteAgent.md)
