cancel
Showing results for 
Search instead for 
Did you mean: 

How to show a modal dialog box to attach a file in SAP B1 9.2 PL04 Web Browser Access?

shuqair_samer
Explorer
0 Kudos

Dear Experts,

I am using SAP B1 version 9.2 PL04, I have a requirement to attach a file to UDO form, I am trying to open windows dialog to select a file using the following code segment; it is working fine in debugging and tracing mode and when creating an add-on for this; it is working fine on SAP B1 client, but when try to use SAP B1 9.2 PL04 web browser access; it is not working, the dialog is not open and I got the following message in the status bar:

Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

-------------------------------

Code Segment

OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog();

NativeWindow nw = new NativeWindow();

string ProcessServiceName = "SAP Business One";

nw.AssignHandle(System.Diagnostics.Process.GetProcessesByName(ProcessServiceName)[0].MainWindowHandle);

Global.StatusBar("wrn", "If 'Open File Dialog' is not shown, press Alt + Tab");

DialogResult result = openFileDialog1.ShowDialog(nw);

--------------------------------

Your quick answer is highly appreciated.

Thanks & Regards

Samer Shuqair

Accepted Solutions (0)

Answers (1)

Answers (1)

pedro_magueija
Active Contributor
0 Kudos

Hi,

The normal dialog doesn't work in browser access. You can use SBO_Application.GetFileFromBrowser() to send a file to the server.

Note that GetFileFromBrowser should be used only when in Browser mode. You can use the ClientType property to check.

Pedro Magueija

LinkedIn | Twitter | Blog

huseyin
Discoverer
0 Kudos

Does this function SBO_Application.GetFileFromBrowser() save file to a shared folder on server?

pedro_magueija
Active Contributor
0 Kudos

Hi Hüseyin,

As per the documentation:

"Triggers the Web browser to upload a file to the server. After the file is uploaded, returns the full path of the file that is saved on the server."

Pedro Magueija

LinkedIn | Twitter | Blog