Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Event Request] No Series add back an event OnBeforeGetNextNo #26418

Closed
FrankAuwers opened this issue May 6, 2024 · 1 comment
Closed

[Event Request] No Series add back an event OnBeforeGetNextNo #26418

FrankAuwers opened this issue May 6, 2024 · 1 comment
Labels
event-request Request for adding an event Integration GitHub request for Integration area wontfix This will not be worked on

Comments

@FrankAuwers
Copy link
Contributor

FrankAuwers commented May 6, 2024

Describe the request

The code of the No. Series is changed in version 24.x.x.x

Before we have an event "OnBeforeGetNextNo" in codeunit "NoSeriesManagement".
We use this event to create new "No. Serie Line" records based on the date.
At this time we can't use it any more.

Therefor the question for creating a event "OnBeforeGetNextNo" that is executed in the codeunit "No. Series - Impl." at the start of the procedure "GetNextNo".

Additional context

We use this to create the Serie No. Lines based on a template field and the the requested date. With this we make it possible for our customers that the No. Series can easily change every month or year base on the template and the requested date.
Internal work item: AB#534601

@FrankAuwers FrankAuwers changed the title No Series add back an event OnBeforeGetNextNo [event request] No Series add back an event OnBeforeGetNextNo May 6, 2024
@FrankAuwers FrankAuwers changed the title [event request] No Series add back an event OnBeforeGetNextNo [Event Request] No Series add back an event OnBeforeGetNextNo May 6, 2024
@AndersLarsenMicrosoft AndersLarsenMicrosoft added event-request Request for adding an event Integration GitHub request for Integration area labels May 12, 2024
@grobyns
Copy link
Contributor

grobyns commented Jun 26, 2024

Hi @FrankAuwers,
Some comments about the approach you've taken: By using an event in GetNextNo your subscriber will run and need to check some things every time a call is made to get a number. I imagine that in 99,9% of cases your subscriber needs to do nothing. In a few well timed instances your code would insert a new line just in time but all other calls your code would simply exit.
It doesn't seem like the best use of resources when really, setting up the lines in advance and setting a reminder to update them should also do the trick.
Adding new lines manually is no fun of course but there's a few solutions out there that already handle No Series Line creation for these scenarios...

Now, as for the event request. The event you're asking for in GetNextNo would not work as you described it. In the new code we have a few overloads of the method so you'd need an event in each. You would then probably also need it in all the PeekNextNo methods.
Once the code reaches GetNextNoInternal it already has a No. Series Line and it's basically too late so we can't add the event there. Also, if an explicit No. Series Line is passed to GetNextNo (or GetNextNoInternal) then we want to use that line and no other.

The one place all these methods have in common before passing an explicit line is the GetNoSeriesLine method. We currently have a request open to place a new event there that you might be able to use for your scenario. (microsoft/BCApps#1362)

In conclusion: I'll close this request and I'd suggest you consider changing approach so you do not need to rely on an event that runs so frequently but, in case you do want to keep using an event, follow, review and contribute to the issue and PR here: microsoft/BCApps#1362 so the event we add also fixes your scenario.

@grobyns grobyns closed this as completed Jun 26, 2024
@grobyns grobyns added the wontfix This will not be worked on label Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-request Request for adding an event Integration GitHub request for Integration area wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants