You are here

How to implement File Browse Functionality?

How can one achieve the requirement to provide a button named "Upload File", and when user clicks it, a file browse window should open, allowing user to select a file and perform an upload of this file in its original format to Siebel File System?

There are 2 options to show the File Open dialog box. The first one is to create a HTML page containing the "HTML File Control" and invoke this HTML page from within Siebel application using "theApplication().ShowModalDialog" browser method. 

Here are the suggested steps:
(1) Create a HTML page named "FileImport.htm" with the following code for example:

<!--

<HTML> 
<HEAD> 
<script language=JavaScript> 
function returnFileValue() 

var filectrl = document.getElementById("myfile"); 
window.returnValue = filectrl.value; 

</Script> 
</HEAD> 
<BODY onunload=returnFileValue();> 
<Input type=file id=myfile> 
</BODY> 
</HTML>

--!>

This HTML page will contain a file control and user can use it to select the file. Note that "returnValue" property will return the value of the selected file to the caller.

(2) Name the file to "FileImport.htm" and place the HTML page in \Client\PUBLIC\ and \siebsrvr\WEBMASTER\ folders.

(3) In the applet, add a button that invokes "FilePopup" method and enable the button in server "WebApplet_PreCanInvokeMethod" event.

(4) Add in the following code in browser "Applet_PreInvokeMethod" event of the applet to invoke the HTML page:
 

switch(name)
{
case "FilePopup":
var ShowModalOptions= "dialogHeight:150px;dialogLeft:100px;dialogWidth:350px;scrollbars:no";
var intRet = theApplication().ShowModalDialog ("FileImport.htm", "", ShowModalOptions);
alert(intRet);

return ("CancelOperation");
break;

default:
return ("ContinueOperation");
break;
}

 



Option 2 is to use "SAFRCFileDlg.FileOpen" or "UserAccounts.CommonDialog" COM objects to show the File Open dialog box. This can be performed directly in Siebel browser script event. As this is provided by a third party, it is not within the scope of our support, please do a search on Google to find out more details on them.

As for uploading the file to Siebel File System in the original format, an external server script (such as ASP, etc) is needed to do so.