Siebel – Autosave Opportunity data – Sample Code
by Renuka AnkamThis is a follow up post on my previous post, Siebel – Autosave Opportunity data – The concept where I introduced the concept and analysis of the following problem statement:
“System should have capability to automatically save opportunity (RFPs) data in Draft state after a certain interval.”
Following is the sample code for solving the above problem statement.
Applet Browser Scripts:-
Event: – Applet_PreInvokeMethod
Language: – eScript
function Applet_PreInvokeMethod (name, inputPropSet)
{
if(name == ‘NewRecord’)
{
var timemsg = setTimeout(“alert(‘Please Fill up all the field value. Otherwise Autosave of the current record will be done!’)”,15000);
theApplication().SetProfileAttr(“AutoSaveNew”,”Y”);
}
return (“ContinueOperation”);
}
Event: – Applet_Load
function Applet_Load ()
{
//var aOppty = this.BusComp();
//var oAccount = aOppty.GetFieldValue(“Account”);
//var oCurrCd = aOppty.GetFieldValue(“Currency Code”);
//var oName = aOppty.GetFieldValue(“Name”);
//var oPrRevDt = aOppty.GetFieldValue(“Primary Revenue Close Date”);
If (theApplication().GetProfileAttr(“AutoSaveLoad”)<>”Y”)
{
var timemsg = setTimeout(“alert(‘Please Fill up all the field value.Otherwise Autosave of the current record will be done!’)”,15000);
theApplication().SetProfileAttr(“AutoSaveLoad”,”Y”);
}
———————————————————————————————
Bus Comp. Server Script:
Event: – BusComp_SetFieldValue
Language: – VBScript
function BusComp_PreWriteRecord ()
{
var aOppty = this.BusComp();
var oAccount = aOppty.GetFieldValue(“Account”);
var oCurrCd = aOppty.GetFieldValue(“Currency Code”);
var oName = aOppty.GetFieldValue(“Name”);
var oPrRevDt = aOppty.GetFieldValue(“Primary Revenue Close Date”);
this.ActivateField(“Account”)
this.ActivateField(“Currency Code”)
this.ActivateField(“Name”)
this.ActivateField(“Primary Revenue Close Date”)
//These below mentioned ones are the required fields being predefaulted by certain values
If ((this.GetFieldValue(“Account “) <> “”) And (this.GetFieldValue(“Currency Code”) <> “”) And (this.GetFieldValue(“Name”) <> “”) And (this.GetFieldValue(“Primary Revenue Close Date”) <> “”) And (TheApplication.GetProfileAttr(“AutoSaveNew “) = “Y” Or TheApplication.GetProfileAttr(“AutoSaveLoad “) = “Y” ))Then
this.Setfieldvalue( “Account “, oAccount);
this.Setfieldvalue (“Currency Code”, oCurrCd);
this.Setfieldvalue (“Name”, oName);
this.Setfieldvalue (“Primary Revenue Close Date”, oPrRevDt);
TheApplication().SetProfileAttr (” AutoSaveLoad “,”N” );
TheApplication().SetProfileAttr (” AutoSaveNew “,”N”)
this.WriteRecord
}
I hope this has been a nice post.
Related posts:
- Siebel – Autosave Opportunity data – The concept Requirement: System should have capability to automatically save opportunity(RFPs) data...
- Siebel – HTML Code displayed in Error Message There was a requirement in our project to make Account...
- Siebel – ActivateField() split wide open In Siebel, we generally tend to use the fields on...
- Siebel – Adding License Keys to Sample I am glad to be associated with Geeks Blogging @...
- Siebel – About SRF Window – Remove data Okay. This is something those who like to toy with...
- Siebel – Reading data directly from Siebel SRF SRF or the Siebel Repository File as it is more...
- Siebel – Make MVG Field required Siebel supports the concept of Multi Valued Fields, or the...
Event: – should be BusComp_PreWriteRecord instead of BusComp_SetFieldValue as mentioned
@ Sajan,
I understand that this may be done by BusComp_PreWriteRecord too, but what’s wrong with doing it in SetFieldValue() ??
I think this is because…
the code itself contains setfieldvalue. If its put in setfieldvalue , it might cause a recursion, and call itself …until siebel terminates the code or crashes the app.
also, it will run for every field in the UI, bringing down performance
I also agree with Ranjith.
Also,script uses function “function BusComp_PreWriteRecord ()” where as the Event mentioned is BusComp_SetFieldValue which is confusing.