Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Event Suscription "Waherhouse Pick" returning values

Posted on by 338
Hi Everybody,
I have made a suscription for Page Warehouse pick:
[EventSubscriber(ObjectType::Page, Page::"Warehouse Pick", 'OnAfterActionEvent', 'RegisterPick', true, true)]
    local procedure RegistraInfoPicking(var Rec: Record "Warehouse Activity Header")
But, I can't catch  Registered Pick's ID, process executes perfectly but Im not able yet to get this value that I need to fill some info for an external appl.
Pls, anybody can help me? 
Thks,
Marisol
  • MarisolC Profile Picture
    MarisolC 338 on at
    RE: Event Suscription "Waherhouse Pick" returning values

    By now Im pretty clear about Recorder Event, and because of that I thought that getting some values in the OnAfterPost will get me to the right moment when data has been commited to database and from there I could consult data with some confidence, what I need to do now,  is after a pick warehouse as been posted, I need to consult registered pick number as I need to give that number to a secondary appl, but, Im still unable to catch that specific moment where OnAfterPost is really finished,

    pastedimage1639379592663v1.png

    So for my first option I used RegisterPick's Event from Page's Object Warehouse Pick, didnt work, then I used what you suggested, but didn't work either. 

    When my pick warehouse is totally posted, and just after that, is when I need to consult its ID so I can save it, and that is all.

    TIA for your great help and patience.

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Event Suscription "Waherhouse Pick" returning values

    If you are working with processes that do some kind of posting you generally want to look at events that starts with OnAfterPost......... because they are triggered after the posting is completed and transactions are committed in the database.

    And in the OnAfterPost........ triggers raising and error will not roll back the posting.

    There is also a tool in Business Central called the event recorder that you can run for a whole process or a part of a process and that will show you what events are triggered and in what order. The tool might be a bit overwhelming in the beginning but is some scenarios it is very useful.

    You can read some more about it here and there are also a lot of technical blog posts avalible around this.

    docs.microsoft.com/.../devenv-events-discoverability

  • MarisolC Profile Picture
    MarisolC 338 on at
    RE: Event Suscription "Waherhouse Pick" returning values

    When do you know a task is really finished, because when my routine is suscribed to this Event, and I try to recover information for lines, they doesn't exist either in picking lines nor picking registered lines, so I'm little confused about timing. I have tried to suscribe to

       [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Activity-Register", 'OnAfterRegisterWhseActivityLines', '', true, true)]

       local procedure "Whse.-Activity-Register_OnAfterRegisterWhseActivityLines"

                      (var WarehouseActivityLine: Record "Warehouse Activity Line")

    but then I can't see header values... :|

    How can I identify when a transaction or a whole process has been finished completly?

    I'm a little bit confused and lost :(

    TIA

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Event Suscription "Waherhouse Pick" returning values

    Hi,

    I think you should have a look at this integration event instead of the on you have tried using.

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Activity-Post", 'OnAfterPostedInvtPickHeaderInsert', '', false, false)]

       local procedure OnAfterPostedInvtPickHeaderInsert(var PostedInvtPickHeader: Record "Posted Invt. Pick Header"; WarehouseActivityHeader: Record "Warehouse Activity Header");

       begin

       end;

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans