Help Needed – Running SAP B1 Automation in Background with Computer Vision

Hi Community,

I have automated the SAP B1 application inside a VM using Computer Vision activities, but I am facing an issue when trying to run the process unattended. The automation is failing with the error “foreground not found” whenever it runs in the background.

Could you please guide me on how to make Computer Vision automation work in the background for SAP B1 inside a VM, or suggest the best approach to achieve an unattended run?

Thanks in advance for your support!

hi, @Sushma_Ganapatisa Computer Vision cannot run truly in the background because it needs the screen to be visible.For unattended SAP B1 automation in a VM, use SAP GUI scripting or UI Automation activities instead of Computer Vision. This works reliably in the background without needing the screen to be active.

1 Like

Dear @Sushma_Ganapatisa,

You cant run CV activites in backgorund as they are part of UiPath.UIAutomation.Activities

The “foreground not found” error means the automation is trying to interact with UI elements that aren’t visible in the background session.
Hence, convert your project to run in foregound or use foregound scope for the activities which required UI interactions.

Br,
NikZ

Hi @Sushma_Ganapatisa

As per my knowledge computer vision needs visible UI, so it won’t work in true background. use remote runtime if using rdp or citrix. if issue continues, switch to selectors or image automation.

If helpful, mark as solution. Happy automation with UiPath

After installing the Runtime in the VM, it is not working, giving the following error

> Click ‘’***** …‘’: Cannot bring the target application to the foreground.*

Could you please help me understand how running in foreground works in unattended mode, and whether it is possible?

Try to increase delay before actions and use check state to confirm app readiness. avoid disconnected rdp sessions and re-indicate ui elements or use selectors if computer vision fails.

Happy Automation

I am unable to understand why, even after installing the runtime, it is still running in CV mode. I added a check for app state and waited, but it’s not working