I noticed something very funny in our Siebel application, I have written a script on the WriteRecord event of a BC. Apparently the record is written to the DB only when the 'Ctrl + S' or 'Ctrl + Up/Down Arrow key' is used for a step down. When I do a step down suing the mouse (by clicking on the next record) the record does not get saved.
We are using Siebel Sales 7.7. Has anyone else come accross this issue. What I am more interested to know is that if this is a product defect or a mistake in my script. And after using the WriteRecord() in the WriteRecord() event code the record gets correctly saved
What is your Applet Web Template Type youre using(Base/Edit/Edit List) ? To my understanding to archive the behavior you describe try setting it to edit or edit list. When you step of the record using mouse it will automatic save on the DB like you describe.
Thanks for your replies guys, The applet is being used in Edit List mode, the script is written on the BC. App version 220.127.116.11  SIA
Here is the code -
function BusComp_WriteRecord ()
if(this.GetFieldValue("Verification Flag") == "Y" && TheApplication().GetProfileAttr("SET_DATE") == "Y")
var SysDate = Clib.time();
var ObjDate = Date.fromSystem(SysDate);
var Month = ToString(ObjDate.getMonth()+1);
var Day = ToString(ObjDate.getDate());
var Year = ToString(ObjDate.getFullYear());
var Hour = ToString(ObjDate.getHours());
var Minute = ToString(ObjDate.getMinutes());
var Second = ToString(ObjDate.getSeconds());
The original solution by using SetFieldValue (without WriteRecord) in the WriteRecord event should never have worked.
All the code that is written in the WriteRecord event is executed AFTER the changes have been saved to the database.
One scenario would be to update child records with the new values in the current record.
But also in that case you would still have to do a WriteRecord for the child records.
As you noticed you will need to do another WriteRecord to commit the SetFieldvalue in the WriteRecord event.
Putting your code in the PreWriteRecord event will mean that the SetFieldvalue in the code gets written to the database together with the other changes.
The fact that it worked with CTRL+S or CTRL-Arrow is a bug (in my opinion), even though it did give your wanted result.