This content has been marked as final. Show 8 replies
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.
Did you try to debug you script?
Perhaps it's a bug, perhaps it's your code.
It's hard to tell with the current information.
Can you also tell us the exact Siebel version and if you are on SEA or SIA?
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());
var now = Month+"/"+Day+"/"+Year+" "+Hour+":"+Minute+":"+Second;
I think it's a bit late to activate fields in the WriteRecord event.1 person found this helpful
But that wouldn't explain why it works with CTRL+S and not by navigating away from the record.
You can try to make those fields Force Active in Tools and see if that makes a difference.
Nope, I tried making the field force active - does not work. It works fine if we use the WriteRecord(); statement after the setfield however. Was wondering if this could be a Bug? you think so?
Thanks and appreciate your help!
It could be a bug, but this doesn't look like a good design to me.1 person found this helpful
Perhaps if you move your code to the PreWriteRecord event it works better?
This code works on the pre-writerecord event. However, I'm still not convinced why it worked with a step down from the keyboard but not the mouse.
Thanks Jiyong! cheers!
Just to wrap things up.
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.