Report 5182 Delete Opportunities

App
Base Application
Namespace
Microsoft.CRM.Opportunity
Versions
17-28

Versions171819202122232425262728

Source29

Source in 29

src/Layers/W1/BaseApp/CRM/Opportunity/DeleteOpportunities.Report.al57 lines, Copyright (c) Microsoft Corporation. MIT

// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.CRM.Opportunity;

using Microsoft.CRM.Comment;

report 5182 "Delete Opportunities"
{
    Caption = 'Delete Opportunities';
    ToolTip = 'Find and delete closed opportunity entries.';
    ProcessingOnly = true;

    dataset
    {
        dataitem(Opportunity; Opportunity)
        {
            DataItemTableView = where(Closed = const(true));
            RequestFilterFields = "No.", "Date Closed", "Salesperson Code", "Campaign No.", "Contact No.", "Sales Cycle Code";

            trigger OnAfterGetRecord()
            begin
                RMCommentLine.SetRange("Table Name", RMCommentLine."Table Name"::Opportunity);
                RMCommentLine.SetRange("No.", "No.");
                RMCommentLine.DeleteAll();

                OppEntry.SetRange("Opportunity No.", "No.");
                OppEntry.DeleteAll();

                Delete();
            end;
        }
    }

    requestpage
    {

        layout
        {
        }

        actions
        {
        }
    }

    labels
    {
    }

    var
        RMCommentLine: Record "Rlshp. Mgt. Comment Line";
        OppEntry: Record "Opportunity Entry";
}