Skip to content

[Event Request] codeunit 88 "Sales Post via Job Queue" trigger OnRun() #30280

@kmistrytnp

Description

@kmistrytnp

Why do you need this change?

I want to be able to call my own custom sales posting routine which is a wrapper really around the standard sales posting - it has various logic including the ability to split the posting and call the standard posting routine multiple times.

I can achieve this in all the places calling the standard sales post (except one), i.e. in the following codeunits I have an IsHandled event available...

codeunit 79	"Sales-Post and Send" - OnCodeOnBeforePostSalesHeader(SalesHeader, TempDocumentSendingProfile, HideDialog, IsHandled);
codeunit 81 "Sales-Post (Yes/No)" - OnBeforeRunSalesPost(SalesHeader, IsHandled, SuppressCommit);
codeunit 82	"Sales-Post + Print" - OnBeforeConfirmPost(SalesHeader, HideDialog, IsHandled, SendReportAsEmail, DefaultOption);
codeunit 89 "Sales-Post + Email" - OnBeforePostAndEMail(SalesHeader, HideDialog, IsHandled, HideMailDialog);

but there is 1 codeunit where I am not able to do this because there is no IsHandled parameter like there is on all the other sales posting related codeunits...

codeunit 88 "Sales Post via Job Queue" - OnRunOnBeforeRunSalesPost(SalesHeader);

Describe the request

Please can you extend the event as follows...

Current code

        OnRunOnBeforeRunSalesPost(SalesHeader);
        if not Codeunit.Run(Codeunit::"Sales-Post", SalesHeader) then begin

New code

        IsSuccess := false;
        IsHandled := false;
        OnRunOnBeforeRunSalesPost(SalesHeader, IsSuccess, IsHandled);
        if not isHandled then
            IsSuccess := Codeunit.Run(Codeunit::"Sales-Post", SalesHeader);
        if not IsSuccess then begin

This will not break anything because...

  1. The event is an IntegrationEvent not a BusinessEvent, so it can be changed
  2. Added extra params does NOT break existing subscribers as subscriber parameters are optional
  3. The default behaviour remains unchanged - i.e. it doesn't break anything

Adding an IsHandled parameter will make it consistent with all the other codeunits which call Sales Post as they all have an IsHandled parameter which allows you to bypass calling the standard Sales Post codeunit, this is the only codeunit which doesn't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions