microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
775 stars 612 forks source link

[Event Request] - OnAfterLookupBuyFromCity in Table 38 "Purchase Header" #20993

Closed oldmat closed 1 year ago

oldmat commented 1 year ago

Hello, please consider adding the following event to Table 38 "Purchase Header"

[IntegrationEvent(false, false)]
local procedure OnAfterLookupBuyFromCity(var PurchaseHeader: Record "Purchase Header")
begin
end;

and raise it accordingly inside "OnLookup" trigger of field 83"Buy-from City":

        trigger OnLookup()
        begin
            LookupPostCode("Pay-to City", "Pay-to Post Code", "Pay-to County", "Pay-to Country/Region Code", CurrFieldNo);

            **OnAfterLookupBuyFromCity(Rec);**
        end;

Thank you!

adejsy commented 1 year ago

Inside the procedure LookupPostCode it raises an integration event called OnLookupPostCode - does that not achieve the same as what you are asking for above?

image

oldmat commented 1 year ago

Unfortunately no. I need to know what is the calling procedure (if lookup of Buy-from, Pay-to pr Ship-to), and inside the LookupPostCode procedure there is not that info.

The whole problem starts from the relation between "Territory Code" and "PostCode" + City: in BC this relation is not managed, while here in Italy is widely used.

adejsy commented 1 year ago

In the procedure and the integration event that is raised it passes you the CalledFromFieldNo so you can then see where it was called from...

oldmat commented 1 year ago

I see, you're right. In general i don't feel very comfortable trusting the CurrFieldNo variable, since its value depends on the beginning of the execution flow. In this case, since the flow starts with a lookup action, i will follow your suggestion.

Thank you !

adejsy commented 1 year ago

No worries - just thought it might help you in progressing rather than having to wait for a minor release with these in (if they were included).

Do you think you could follow the same pattern for the other Event Requests that you raised that seem similar?

oldmat commented 1 year ago

Yes, absolutely!

Vadim-Stepanenko commented 1 year ago

Closing as no longer needed