I have a code unit that I want to be able to run either directly or through a batch job in Business Central. I want to have the flexibility to choose how to run the code unit based on my preference without having to modify the code unit each time.
The reason for this is that I don't want the screen to block every time I run that code unit. I want to be able to choose to run it in the background or in a queue so that it doesn't interfere with my work.
What is the best approach to accomplish this? Should I add my code unit to a job on the Job Queue Entries page, If yes, then how can I manage it to run whenever I want?
I would appreciate any guidance or help.
Thank you.