AL icon indicating copy to clipboard operation
AL copied to clipboard

Remember the OnAction trigger or RunObject property on an action

Open stijn9830 opened this issue 7 years ago • 1 comments

  • AL Extension Version: 4.0.199169
  • Server Version: Version: Platform 14.0.35916.0 + Application 35970 (BE Business Central 14.5)

When all codeanalyzers installed/activated , this code gives warnings because runobject or onaction trigger is not filled in. It isn't. I am using an event to call this action. Is this not the correct way?

    addafter("&Job")
    {
        group("PBL-PA")
        {
            action("PBL Request approval")
            {
                ApplicationArea = All;
                Caption = 'Request approval';
                ToolTip = 'Request approval';
                Image = SendApprovalRequest;
                Promoted = true;
                PromotedCategory = Process;
                PromotedIsBig = true;
                
                trigger OnAction()
                begin
                    
                end;
            }




[EventSubscriber(ObjectType::Page,Page::"Job Card", 'OnAfterActionEvent', 'PBL Request approval', false, false)]
local procedure OnRequestApprovalActionJobCard(var Rec: Record Job)
var
    //Defaultprojectstatus: Record "Default project status";
    //Job: Record Job;
    Jobstatus: Record "PBL Project Status";
    NoStatusFoundError_Lbl: Label 'No Status Code found with project type %1.';

begin
    //PBPA01 20190117 HM <<
    Jobstatus.RESET();
    Jobstatus.SETRANGE("Project No.", Rec."No.");
    Jobstatus.SETRANGE("Project Type", Rec."Project Type");
    Jobstatus.SETRANGE("Status Type", Jobstatus."Status Type"::"Project Requested");
    IF Jobstatus.FINDSET() THEN BEGIN
        Rec."Status Code" := Jobstatus."Status Code";
        Rec."Status Type" := Jobstatus."Status Type";
    END ELSE
        ERROR(NoStatusFoundError_Lbl, Rec."Project Type");
    //PBPA01 20190117 HM >>
end;

stijn9830 avatar Nov 25 '19 11:11 stijn9830

Let's get the issue to a team who will fix and backport it, as this repository is only for issues related to the latest developer preview environment for Dynamics 365 Business Central. We suggest that you open a support case or file a bug in Collaborate, to ensure that all Business Central users benefit from your catch as soon as possible.

To open a support case, you can:

  • Open a support request to CSS through the PartnerSource portal
  • Contact your Service Account Manager (SAM) in your local subsidiary to understand what is included in your contract as of support incident and PAH (Partner Advisory Hours). Your SAM might also direct you "step by step" how to open a support request or how to get credentials, if this is the first time for you or your company

If you file the bug in Collaborate, remember to include steps to reproduce the issue, and the Business Central build number and country version you're using.

PooyaKharamesh avatar Nov 26 '19 09:11 PooyaKharamesh