---
id: object/table/5092
type: object
title: Table 5092 "Opportunity"
summary: Table 5092 "Opportunity" in Base Application (Microsoft.CRM.Opportunity). 39 fields, 16 public procedures, 24 events. Present since at least BC23, still in BC30, changed in BC24-28.
tier: official
language: en
tags:
  - table
  - base application
versions:
  introduced: null
  last_changed: "28"
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 42187566a5e63cf1100a9262e5dcaae8339f7b222e2aa7f26266d6e48a7e405a
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/CRM/Opportunity/Opportunity.Table.al
    title: src/Layers/W1/BaseApp/CRM/Opportunity/Opportunity.Table.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn:
    - https://learn.microsoft.com/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_opportunity_create
    - https://learn.microsoft.com/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_opportunity_delete
    - https://learn.microsoft.com/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_opportunity_get
    - https://learn.microsoft.com/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_opportunity_update
    - https://learn.microsoft.com/dynamics365/business-central/dev-itpro/api-reference/v2.0/resources/dynamics_opportunity
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: table
object_id: 5092
name: Opportunity
namespace: Microsoft.CRM.Opportunity
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 39
  procedures: 59
  events: 24
  subscribers: 0
relations:
  out: 24
  referenced_by: 11
  pages: 7
  extended_by: 0
  event_subscribers: 4
  calls: 4
  called_by: 0
  implements: 0
---

# Table 5092 "Opportunity"

> Table 5092 "Opportunity" in Base Application (Microsoft.CRM.Opportunity). 39 fields, 16 public procedures, 24 events. Present since at least BC23, still in BC30, changed in BC24-28.

Base Application · Microsoft.CRM.Opportunity · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/CRM/Opportunity/Opportunity.Table.al) · facts from BC29

Learn documents this table through its pages: [Page 30070 "APIV2 - Opportunities"](../page/30070.md) (5 Learn pages).

## Properties

| Property | Value |
|---|---|
| Caption | Opportunity |
| DataClassification | CustomerContent |

## Fields

Explanation: the field's ToolTip in the code; without one, the ToolTip of a page control bound to the field (marked via the page); without that, its Caption (marked caption) when that differs from the name.

| No. | Name | Type | Explanation | Notes |
|---|---|---|---|---|
| 1 | No. | Code[20] | Specifies the number of the involved entry or record, according to the specified number series. |  |
| 2 | Description | Text[100] | Specifies the description of the opportunity. |  |
| 3 | Salesperson Code | Code[20] | Specifies the code of the salesperson that is responsible for the opportunity. | TableRelation [Table 13 "Salesperson/Purchaser"](../table/13.md) ("Salesperson/Purchaser" where(Blocked = const(false))) |
| 4 | Campaign No. | Code[20] | Specifies the number of the campaign to which this opportunity is linked. | TableRelation [Table 5071 "Campaign"](../table/5071.md) |
| 5 | Contact No. | Code[20] | Specifies the number of the contact that this opportunity is linked to. | TableRelation [Table 5050 "Contact"](../table/5050.md) |
| 6 | Contact Company No. | Code[20] | Specifies the number of the company that is linked to this opportunity. | TableRelation [Table 5050 "Contact"](../table/5050.md) (Contact where(Type = const(Company))) |
| 7 | Sales Cycle Code | Code[10] | Specifies the code of the sales cycle that the opportunity is linked to. | TableRelation [Table 5090 "Sales Cycle"](../table/5090.md) (Sales Cycle) |
| 8 | Sales Document No. | Code[20] | Specifies the number of the sales document that has been created for this opportunity. | TableRelation [Table 36 "Sales Header"](../table/36.md) (if ("Sales Document Type" = const(Quote)) "Sales Header"."No." where("Document Type" = const(Quote), "Sell-to Contact No." = field("Contact No.")) else if ("Sales Document Type" = const(Order)) "Sales Header"."No." where("Document Type" = const(Order), "Sell-to Contact No." = field("Contact No.")) e...) |
| 9 | Creation Date | Date | Specifies the date that the opportunity was created. |  |
| 10 | Status | Enum "Opportunity Status" | Specifies the status of the opportunity. There are four options: | enum [Enum 5092 "Opportunity Status"](../enum/5092.md); not editable |
| 11 | Priority | Enum "Opportunity Priority" | Specifies the priority of the opportunity. There are three options: | enum [Enum 5093 "Opportunity Priority"](../enum/5093.md) |
| 12 | Closed | Boolean | Specifies that the opportunity is closed. | not editable |
| 13 | Date Closed | Date | Specifies the date the opportunity was closed. | not editable |
| 15 | No. Series | Code[20] | — | TableRelation [Table 308 "No. Series"](../table/308.md) (No. Series); not editable |
| 16 | Comment | Boolean | — | FlowField: exist("Rlshp. Mgt. Comment Line" where("Table Name" = const(Opportunity), "No." = field("No."))); not editable |
| 17 | Current Sales Cycle Stage | Integer | Specifies the current sales cycle stage of the opportunity. | FlowField: lookup("Opportunity Entry"."Sales Cycle Stage" where("Opportunity No." = field("No."), Active = const(true))); not editable |
| 18 | Estimated Value (LCY) | Decimal | Specifies the estimated value of the opportunity. <small>via [Page 5127 "Opportunity Statistics"](../page/5127.md)</small> | FlowField: sum("Opportunity Entry"."Estimated Value (LCY)" where("Opportunity No." = field("No."), Active = const(true))); not editable |
| 19 | Probability % | Decimal | Specifies the probability of the opportunity resulting in a sale. | FlowField: lookup("Opportunity Entry"."Probability %" where("Opportunity No." = field("No."), Active = const(true))); not editable |
| 20 | Calcd. Current Value (LCY) | Decimal | Specifies the current calculated value of the opportunity. <small>via [Page 5127 "Opportunity Statistics"](../page/5127.md)</small> | FlowField: sum("Opportunity Entry"."Calcd. Current Value (LCY)" where("Opportunity No." = field("No."), Active = const(true))); not editable |
| 21 | Chances of Success % | Decimal | Specifies the chances of success of the opportunity. | FlowField: lookup("Opportunity Entry"."Chances of Success %" where("Opportunity No." = field("No."), Active = const(true))); not editable |
| 22 | Completed % | Decimal | Specifies the percentage of the sales cycle that has been completed for this opportunity. | FlowField: lookup("Opportunity Entry"."Completed %" where("Opportunity No." = field("No."), Active = const(true))); not editable |
| 23 | Contact Name | Text[100] | Specifies the name of the contact to which this opportunity is linked. The program automatically fills in this field when you have entered a number in the No. field. | FlowField: lookup(Contact.Name where("No." = field("Contact No."))); not editable |
| 24 | Contact Company Name | Text[100] | Specifies the name of the company of the contact person to which this opportunity is linked. The program automatically fills in this field when you have entered a number in the Contact Company No. field. | FlowField: lookup(Contact.Name where("No." = field("Contact Company No."))); not editable |
| 25 | Salesperson Name | Text[50] | — | FlowField: lookup("Salesperson/Purchaser".Name where(Code = field("Salesperson Code"))); not editable |
| 26 | Campaign Description | Text[100] | Specifies the description of the campaign to which the opportunity is linked. The program automatically fills in this field when you have entered a number in the Campaign No. field. | FlowField: lookup(Campaign.Description where("No." = field("Campaign No."))); not editable |
| 27 | Segment No. | Code[20] | Specifies the number of the segment (if any) that is linked to the opportunity. | TableRelation [Table 5076 "Segment Header"](../table/5076.md) (Segment Header) |
| 28 | Estimated Closing Date | Date | Specifies the estimated closing date of the opportunity. | FlowField: lookup("Opportunity Entry"."Estimated Close Date" where("Opportunity No." = field("No."), Active = const(true))); not editable |
| 29 | Sales Document Type | Enum "Opportunity Document Type" | Specifies the type of the sales document (Quote, Order, Posted Invoice). The combination of Sales Document No. and Sales Document Type specifies which sales document is assigned to the opportunity. | enum [Enum 5096 "Opportunity Document Type"](../enum/5096.md) |
| 30 | No. of Interactions | Integer | Specifies the number of interactions linked to this opportunity. | FlowField: count("Interaction Log Entry" where("Opportunity No." = field(filter("No.")), Canceled = const(false), Postponed = const(false))); not editable |
| 720 | Coupled to CRM | Boolean | Coupled to Dynamics 365 Sales <small>caption</small> | obsolete Removed 26.0; #if not CLEANSCHEMA26; not editable |
| 721 | Coupled to Dataverse | Boolean | Specifies that the opportunity is coupled to an opportunity in Dynamics 365 Sales. | FlowField: exist("CRM Integration Record" where("Integration ID" = field(SystemId), "Table ID" = const(Database::Opportunity))); not editable |
| 9501 | Wizard Step | Option | — | OptionCaption: ,1,2,3,4,5,6; not editable |
| 9502 | Activate First Stage | Boolean | Specifies if the opportunity is to be activated. If you select the check box, then you can fill out the remainder of the fields on this page. In the Opportunity Card window, the status is set to In Progress. |  |
| 9503 | Segment Description | Text[100] | Specifies a description of the segment that is related to the opportunity. The description is copied from the segment card. |  |
| 9504 | Wizard Estimated Value (LCY) | Decimal | Specifies the value in the wizard for the opportunity. You can specify an estimated value of the opportunity in local currency in this field. <small>via [Page 5126 "Create Opportunity"](../page/5126.md)</small> |  |
| 9505 | Wizard Chances of Success % | Decimal | Specifies the value in the wizard for the opportunity. You can specify a percentage completion estimate in this field. |  |
| 9506 | Wizard Estimated Closing Date | Date | Specifies a closing date for the opportunity from the wizard. |  |
| 9507 | Wizard Contact Name | Text[100] | Specifies the contact who is involved in this opportunity. |  |
| 9508 | Wizard Campaign Description | Text[100] | Specifies the campaign that the opportunity is related to. The description is copied from the campaign card. |  |

## Keys

- Key1: No. (clustered)
- Key2: Contact Company No., Contact No., Closed
- Key3: Salesperson Code, Closed
- Key4: Campaign No., Closed
- Key5: Segment No., Closed
- Key6: Sales Document Type, Sales Document No.
- Key7: Description
- Key8: SystemModifiedAt

## Events published

- `OnAfterFinishWizard(var Opportunity: Record Opportunity)` (integration)
- `OnAfterInsertOpportunity(var Opportunity: Record Opportunity)` (integration)
- `OnAfterStartActivateFirstStage(SalesCycleStage: Record "Sales Cycle Stage"; var OpportunityEntry: Record "Opportunity Entry"; var Opportunity: Record Opportunity)` (integration)
  - subscribers: [Codeunit 38506 "Opportunities External Events"](../codeunit/38506.md) OnAfterStartActivateFirstStage
- `OnBeforeGetNewCustomerTemplateCode(Cont: Record Contact; var CustTemplateCode: Code[20]; var IsHandled: Boolean)` (integration)
- `OnBeforeCheckStatus(var Opportunity: Record Opportunity; var OppEntry: Record "Opportunity Entry"; var IsHandled: Boolean)` (integration)
- `OnBeforeCheckCampaign(var Opportunity: Record Opportunity; var IsHandled: Boolean)` (integration)
- `OnBeforeFinishWizard(var Opportunity: Record Opportunity; var OpportunityEntry: Record "Opportunity Entry")` (integration)
- `OnBeforeProcessFirstStage(var Opportunity: Record Opportunity; var OpportunityEntry2: Record "Opportunity Entry"; ActivateFirstStage: Boolean; CalledForSegment: Boolean; SalesPersonCode: Code[20])` (integration)
- `OnBeforeRunPageForRec(var Opportunity: Record Opportunity; var PageID: Integer)` (integration)
- `OnCreateOppFromOppOnAfterInit(var Opportunity: Record Opportunity; var DoSetDefaultSalesCycle: Boolean)` (integration)
- `OnCreateQuoteOnAfterSalesHeaderInsert(var SalesHeader: Record "Sales Header"; var Opportunity: Record Opportunity)` (integration)
- `OnCreateQuoteOnBeforeSalesHeaderInsert(var SalesHeader: Record "Sales Header"; var Opportunity: Record Opportunity)` (integration)
- `OnCreateQuoteOnBeforePageRun(var SalesHeader: Record "Sales Header"; var Opportunity: Record Opportunity)` (integration)
  - subscribers: [Codeunit 38506 "Opportunities External Events"](../codeunit/38506.md) OnCreateQuote
- `OnFinishWizardOnBeforeInsertOpportunity(var Opportunity: Record Opportunity; var OppEntry: Record "Opportunity Entry")` (integration)
- `OnLookupCampaignsOnAfterSetFilters(var Opportunity: Record Opportunity; var Campaign: Record Campaign)` (integration)
- `OnCreateFromCreateFromInteractionLogEntryOnBeforeInsert(var Opportunity: Record Opportunity; InteractionLogEntry: Record "Interaction Log Entry")` (integration)
- `OnCreateFromSegmentLineOnBeforeInsert(var Opportunity: Record Opportunity; SegmentLine: Record "Segment Line")` (integration)
- `OnBeforeRunQuotePage(var SalesHeader: Record "Sales Header"; Modal: Boolean; var IsHandled: Boolean)` (integration)
- `OnCreateOppFromOppOnBeforeSetFilterSalesPersonCode(var Opportunity: Record Opportunity; var IsHandled: Boolean; var FromOpportunity: Record Opportunity)` (integration)
- `OnAfterProcessFirstStage(var OpportunityEntry: Record "Opportunity Entry")` (integration)
- `OnBeforeValidateContactNo(var Opportunity: Record Opportunity; CurrentFieldNo: Integer; var IsHandled: Boolean; xOpportunity: Record Opportunity)` (integration)
- `OnStartWizardBeforeInsert(var Opportunity: Record Opportunity)` (integration)
- `OnStartActivateFirstStageOnBeforeSalesCycleStageFind(var Opportunity: Record Opportunity; var SalesCycleStage: Record "Sales Cycle Stage")` (integration)
- `OnBeforeUpdateOpportunity(var Opportunity: Record Opportunity)` (integration)

## Trigger event subscribers

- OnAfterDeleteEvent: [Codeunit 1173 "Document Attachment Mgmt"](../codeunit/1173.md) DeleteAttachedDocumentsOnAfterDeleteOpportunity
- OnAfterRenameEvent: [Codeunit 1173 "Document Attachment Mgmt"](../codeunit/1173.md) MoveAttachedDocumentsOnAfterRenameOpportunity

## Procedures

- `CreateFromInteractionLogEntry(InteractionLogEntry: Record "Interaction Log Entry")`
- `CreateFromSegmentLine(SegmentLine: Record "Segment Line")`
- `CreateOppFromOpp(var Opportunity: Record Opportunity)`
- `UpdateOpportunity()`
- `CloseOpportunity()`
- `CreateQuote()`
- `ShowQuote()`
- `CheckStatus()`
- `FinishWizard()`
- `SetComments(var RMCommentLine: Record "Rlshp. Mgt. Comment Line")`
- `ShowSalesQuoteWithCheck()`
- `SetSegmentFromFilter()`
- `SetContactFromFilter()`
- `StartActivateFirstStage()`
- `SetDefaultSalesCycle()`
- `SetCampaignFromFilter()`

Plus 19 local procedures.

## Triggers

OnDelete, OnInsert

## Relations

- drill-down page [Page 5123 "Opportunity List"](../page/5123.md)
- lookup page [Page 5123 "Opportunity List"](../page/5123.md)
- Salesperson Name: CalcFormula [Table 13 "Salesperson/Purchaser"](../table/13.md)
- Salesperson Code: TableRelation [Table 13 "Salesperson/Purchaser"](../table/13.md)
- No. Series: TableRelation [Table 308 "No. Series"](../table/308.md)
- Sales Document No.: TableRelation [Table 36 "Sales Header"](../table/36.md) (conditional)
- Contact Company Name: CalcFormula [Table 5050 "Contact"](../table/5050.md)
- Contact Name: CalcFormula [Table 5050 "Contact"](../table/5050.md)
- Contact Company No.: TableRelation [Table 5050 "Contact"](../table/5050.md)
- Contact No.: TableRelation [Table 5050 "Contact"](../table/5050.md)
- Comment: CalcFormula [Table 5061 "Rlshp. Mgt. Comment Line"](../table/5061.md)
- No. of Interactions: CalcFormula [Table 5065 "Interaction Log Entry"](../table/5065.md)
- Campaign Description: CalcFormula [Table 5071 "Campaign"](../table/5071.md)
- Campaign No.: TableRelation [Table 5071 "Campaign"](../table/5071.md)
- Segment No.: TableRelation [Table 5076 "Segment Header"](../table/5076.md)
- Sales Cycle Code: TableRelation [Table 5090 "Sales Cycle"](../table/5090.md)
- Calcd. Current Value (LCY): CalcFormula [Table 5093 "Opportunity Entry"](../table/5093.md)
- Chances of Success %: CalcFormula [Table 5093 "Opportunity Entry"](../table/5093.md)
- Completed %: CalcFormula [Table 5093 "Opportunity Entry"](../table/5093.md)
- Current Sales Cycle Stage: CalcFormula [Table 5093 "Opportunity Entry"](../table/5093.md)
- Estimated Closing Date: CalcFormula [Table 5093 "Opportunity Entry"](../table/5093.md)
- Estimated Value (LCY): CalcFormula [Table 5093 "Opportunity Entry"](../table/5093.md)
- Probability %: CalcFormula [Table 5093 "Opportunity Entry"](../table/5093.md)
- Coupled to Dataverse: CalcFormula [Table 5331 "CRM Integration Record"](../table/5331.md)

## Referenced by

11 fields in 9 objects relate to this table (TableRelation or CalcFormula).

- [Table 5080 "To-do"](../table/5080.md): Opportunity Description, Opportunity No.
- [Table 9063 "Relationship Mgmt. Cue"](../table/9063.md): Closed Opportunities, Open Opportunities
- [Table 110 "Sales Shipment Header"](../table/110.md): Opportunity No.
- [Table 112 "Sales Invoice Header"](../table/112.md): Opportunity No.
- [Table 114 "Sales Cr.Memo Header"](../table/114.md): Opportunity No.
- [Table 5065 "Interaction Log Entry"](../table/5065.md): Opportunity No.
- [Table 5077 "Segment Line"](../table/5077.md): Opportunity No.
- [Table 5093 "Opportunity Entry"](../table/5093.md): Opportunity No.
- [Table 6660 "Return Receipt Header"](../table/6660.md): Opportunity No.

## Pages and codeunits on this table

- [Page 30070 "APIV2 - Opportunities"](../page/30070.md) (source table)
- [Page 5123 "Opportunity List"](../page/5123.md) (source table)
- [Page 5124 "Opportunity Card"](../page/5124.md) (source table)
- [Page 5126 "Create Opportunity"](../page/5126.md) (source table)
- [Page 5127 "Opportunity Statistics"](../page/5127.md) (source table)
- [Page 5132 "Active Opportunity List"](../page/5132.md) (source table)
- [Page 5174 "Opportunity Statistics FactBox"](../page/5174.md) (source table)

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 1381 "Customer Templ. Mgt."](../codeunit/1381.md) (1 call: `GetNewCustomerTemplateCode → SelectCustomerTemplate`)
- [Codeunit 27 "Confirm Management"](../codeunit/27.md) (1 call: `StartActivateFirstStage → GetResponse`)
- [Page 41 "Sales Quote"](../page/41.md) (1 call: `RunQuotePage → (object)`)
- [Page 456 "No. Series"](../page/456.md) (1 call: `OnInsert → (object)`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC24-28

## Deprecations

- field Coupled to CRM: Removed 26.0 (#if not CLEANSCHEMA26), "Replaced by flow field Coupled to Dataverse"

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "table", object_name: "Opportunity")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
