CreateFile Method for a Business Component

To create a file in the Siebel file system from an external source, you can use the CreateFile method. This method returns one of the following values:

  • Success. The operation succeeded.

  • Error. The operation did not succeed.

Format

BusComp.InvokeMethod("CreateFile", SrcFilePath, KeyFieldName, KeepLink)

The following table describes the arguments for the CreateFile method.

Argument Description

SrcFilePath

The fully qualified path to the source file on the Siebel Server or the Siebel client.

KeyFieldName

The name of the field in the business component that contains the File Name. For example, AccntFileName in the Account Attachment business component.

KeepLink

Applies to URLs. You can use one of the following values:

  • Y. Use this value if the link to the file is stored as an attachment.

  • N. Use this value if you reference the actual file.

The actual file is compressed in a Siebel proprietary format. Siebel CRM uploads and stores it in that format on the Siebel File System.

Usage

Before you call the CreateFile method, call the NewRecord method to make sure Siebel CRM creates a new business component record.

Used With

To use this method, you can use a BusComp.InvokeMethod call with the following interfaces:

  • COM Data Control

  • COM Data Server

  • Siebel Java Data Bean

  • Mobile Web Client Automation Server

  • Server Script

Examples

The following example is in Siebel VB:

Dim RetValue as String
Dim fileBC as BusComp

'Instantiate fileBC as the appropriate attachment business component

fileBC.NewRecord NewAfter
RetValue = fileBC.InvokeMethod ("CreateFile", "c:\Demo\Image.bmp", "AccntFileName", 
"Y")
fileBC.WriteRecord

The following example is in Siebel eScript:

var fileBC;

// Instantiate fileBC as the appropriate attachment business component

fileBC.NewRecord(NewAfter);
RetValue = fileBC.InvokeMethod ("CreateFile", "C:\\Demo\\Image.bmp", 
"AccntFileName", "Y");
fileBC.WriteRecord();

The following example is in COM Data Control:

Dim errCode as Integer
Dim Args(2) as String
Dim RetValue as String
Dim fileBC as BusComp

'Instantiate fileBC as the appropriate attachment business component

Args(0) = "C:\Demo\Image.bmp"
Args(1) = "AccntFileName"
Args(2) = "Y"

fileBC.NewRecord NewAfter, errCode
RetValue = fileBC.InvokeMethod ("CreateFile", Args, errCode)
fileBC.WriteRecord