50% found this document useful (2 votes)
1K views

How To Attach A File Using Siebel Escript - CreateFile Method

This document describes how to attach an external file to Siebel using the CreateFile eScript method. It provides the Siebel Bookshelf excerpt for CreateFile and includes an example code snippet that creates a new attachment record, calls CreateFile to attach the file at C:\foo.doc to that record, and checks for errors.

Uploaded by

venuram
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
1K views

How To Attach A File Using Siebel Escript - CreateFile Method

This document describes how to attach an external file to Siebel using the CreateFile eScript method. It provides the Siebel Bookshelf excerpt for CreateFile and includes an example code snippet that creates a new attachment record, calls CreateFile to attach the file at C:\foo.doc to that record, and checks for errors.

Uploaded by

venuram
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

How to Attach a File Using Siebel eScript CreateFile Method

This article describes how to attach an external file to the Siebel file system using eScript. For more information on file attachments using eScript, see my blog post on Reading an Attachment Using Siebel eScript - GetFile Method. Similar to the GetFile method in escript to read an attachment file, you can use the CreateFile method to attach an external file to the Siebel file system as an attachment. Here is the Siebel Bookshelf excerpt for the CreateFile method. I have included a code snippet below for an example of creating a new attachment record using Siebel eScript and attaching a file C:\foo.doc to that record. Note that the InvokeMethod returns either "Success" or "Error" depending on success or failure of the call. I have included code to catch if the return is not "Success" and throw the error. However I have always seen that if the CreateFile method is not successful then it will throw an exception anyway with error detail.
1: var boTest; 2: var bcTestAttach; 3: var sGetFileReturn = ""; 4: var sAbsoluteFileName = "C:\foo.doc"; 5: 6: try { 7: boTest = TheApplication().GetBusObject("Test"); 8: bcTestAttach = boTest.GetBusComp("TestAttach"); 9: with (bcTestAttach) 10: { 11: //create a new attachment record with Name = TestAttachment 12: NewRecord(NewAfter); 13: SetFieldValue("Name", "TestAttachment"); 14: SetFieldValue("FileSrcType", "FILE"); 15: WriteRecord(); 16: 17: //call CreateFile method to attach a file on the server to the Siebel 18: //file system 19: sGetFileReturn = InvokeMethod("CreateFile", sAbsoluteFileName, "AttachmentName", "N"); 20: 21: if (sGetFileReturn != "Success") 22: throw("Error attaching file!"); 23: } 24: } 25: catch(e) 26: { 27: TheApplication().RaiseErrorText(e.toString()); 28: } 29: finally

30: 31: 32: 33:

{ bcTestAttach = null; boTestAttach = null; }

You might also like