Wednesday, June 25, 2008

Architecture

Browser Script Architecture :::<<<>>>:::





Smart Web Architecture :::<<<>>>:::



The Red Box Highlighted indicates the functional area of the respective

Scripts .Ie.,

The server scripts interact with the lower layers and the Browser scripts interact

with the Upper layer (UI related).

Diagram

Browser Script Editor::::<<<>>>::::










The Browser Script Editor allows you to write and edit JavaScript that runs within the

Client browser.The Edit Browser Scripts option is available by right-clicking Applet, Business

Component, Application, and Business Service object definitions in Tools. You can also access it from View > Editors > Browser Script Editor Menu.

The result takes the form of Applet Browser Script, BusComp Browser Script, and so on. Each of these object types has a set of scriptable events.

Diagram

Customer Scripting Object Types



Theory

Difference Between :::<<<>>:::

Server Scripts

Browser Scripts

Authored in Siebel Tools

Authored in Siebel Tools

Written in Siebel VB or eScript

Written in Java Script

Executes on Siebel Server (for Web Clients)

or on he Client Machine (for Mobile or

Dedicated Web Clients)

Browser Scripts are downloaded to the

client and execute within the Client.

Limited Support for User Interaction Interfaces available for accessing the Siebel

Limited Support for User Interaction Interfaces available for accessing the Siebel

Siebel Server Script

Sort Opty Con based on opty account:::::<<>>:::

function WebApplet_PreInvokeMethod (MethodName)

{

if (MethodName == "SortContact")

{

var OppAccBO = TheApplication().GetBusObject("Opportunity");

var OppAccBC = OppAccBO.GetBusComp("Opportunity");

var ConBC = this.BusComp("Contact");

//var AccntBO = TheApplication().GetBusObject("Account");

//var AccntBC = AccntBO.GetBusComp("Account");

//OppAccBC.ActivateField("Name");

var sOppAccount = ConBC.ParentBusComp().GetFieldValue("Account");

//var sConAccount = ConBC.GetFieldValue("Account");

var morerecs = ConBC.FirstRecord();

var count = ConBC.CountRecords();

with (ConBC)

{

SetViewMode(AllView);

ClearToQuery();

SetSearchSpec("Account",sOppAccount);

ExecuteQuery(ForwardBackward);

ConBC.NextRecord();

}

return (CancelOperation);

}

return (ContinueOperation);

}

Siebel Server Script

Load event in Service request list applet :::::<<>>::::

function WebApplet_Load ()

{

var oFromButton = TheApplication().GetProfileAttr("FromMyAccListAppl");

if (oFromButton == "true")

{

oFromButton = "false";

var oBC = this.BusComp();

oBC.NewRecord(NewAfter);

oBC.ActivateField("Priority");

oBC.SetFieldValue("Priority","2-High");

var oAccBC = oBC.GetPicklistBusComp("Account");

with (oAccBC)

{

ClearToQuery();

SetViewMode(3);

SetSearchSpec("Id",TheApplication().GetProfileAttr("AccountIdForSR"));

ExecuteQuery();

FirstRecord();

Pick();

}

oAccBC = null;

oBC = null;

oFromButton = null;

}

}

Tuesday, June 24, 2008

Siebel Server Script

Go through the code and get logic ::::----:::::


function BusComp_PreQuery ()

{

var PBo=TheApplication().GetBusObject("Position");

var TBo = TheApplication().GetBusObject("Assignment (No Rule Groups)");

var PBc=PBo.GetBusComp("Position");

var TBc=TBo.GetBusComp("Assignment Group");

var Pos= TheApplication().PositionName();

var OBO= TheApplication().GetBusObject("Opportunity");

var Id=TheApplication().LoginName();

var OBC= this;

var ser=NULL;

//OBC.InvokeMethod("RefreshBusComp");

//OBC.ClearToQuery();

OBC.ExecuteQuery();

var View=OBC.GetViewMode();

var TerBc="";

var TerPos="";

var TerName="";

var temp;

var z=0;

var k="";

var m="";

var a=0;

var b=0;

var d=0;

var c=0;

var sear="";

var expr="";

var srcexpr= new Array();

if (View==0)

{

if ((View==0)||(View==3))

{

with (OBC)

{

SetSearchSpec("Primary Sales Rep Login",Id);

ExecuteQuery(ForwardBackward);

return (ContinueOperation);

}

}

}

if ((View==1)||(View==3))

{

if ((Pos=="VP Sales")||(Pos=="Marketing_Offshore"))

{

with (OBC)

{

//expr="[Territory]!=""";

SetViewMode(5);

ClearToQuery();

RefineQuery();

ExecuteQuery(ForwardBackward);

return (ContinueOperation);

}

}

else

{

with(PBc)

{

ActivateField("Name");

ActivateField("Territory");

SetViewMode(5);

ClearToQuery();

SetSearchSpec("Name","'"+Pos+"'");

ExecuteQuery(ForwardOnly);

if (FirstRecord())

{

TerBc = GetMVGBusComp("Territory");

}

var Postn=GetFieldValue("Name");

var Terri=GetFieldValue("Territory");

if ((Postn==Pos)&&(Terri!=""))

{

{

with (TerBc)

{

ActivateField("Name");

//ActivateField("SSA Primary Field");

ClearToQuery();

ExecuteQuery(ForwardOnly);

b=CountRecords();

a=b-1;

var count = new Array(b);

if (FirstRecord())

{

for (var i=0;i

{

// if (GetFieldValue("SSA Primary Field") == "Y")

{

count[i] = GetFieldValue("Name");

var Terr = count[i];

}

NextRecord();

}

}

}

}

{

for (z=0;z

{

if (z==a)

{

srcexpr="[Territory]= '" + count[z] +"'";

k=k+srcexpr+" ";

}

if (z

{

srcexpr="[Territory]= '" + count[z] +"'";

k=k+srcexpr+" or ";

}

z++;

m=srcexpr+" OR "+ k +" ";

}

}

with (OBC)

{

//if (temp!="test")

{

SetViewMode(3);

ActivateField("Territory");

ActivateField("Position");

ser= OBC.GetSearchExpr();

//ClearToQuery();

RefineQuery();

ExecuteQuery();

if (ser=="")

{

//SetSearchExpr(m);

ClearToQuery();

SetSearchExpr(m);

ExecuteQuery();

return (ContinueOperation);

}

{

if (Terr=="")

{

ExecuteQuery();

return (ContinueOperation);

}

if (View==3)

{

var appnd=ser+" AND ("+m+")";

//SetSearchExpr(appnd);

ClearToQuery();

SetSearchExpr(appnd);

ExecuteQuery();

return (ContinueOperation);

}

if (View==1)

{

var appnd=ser+" OR ("+m+")";

ClearToQuery();

SetSearchExpr(appnd);

//RefineQuery();

ExecuteQuery();

return (ContinueOperation);

}

}

}

}

}

}

}

}

//else

{

SetViewMode(5);

ser= OBC.GetSearchExpr();

ClearToQuery();

RefineQuery();

SetSearchExpr(ser);

ExecuteQuery();

return (ContinueOperation);

}

}

Friday, June 20, 2008

Siebel Server Script

This script changes the color and size of the text in one field based on the contents of a second field ::||::|||||:::::::
_____
::||::|||||:::::::
function Applet_ChangeRecord ()
{
var CtrlCurrency = this.FindControl("Currency");
var bcCase = this.BusComp();
var strValue = bcCase.GetFieldValue("Currency");
if (strValue == "USD")
{
CtrlCurrency.SetProperty("FontColor", "#000000");
CtrlCurrency.SetProperty("FontSize", "8");
CtrlCurrency.SetProperty("FontStyle", "Normal");
return ("ContinueOperation");
}// end if
else
{
CtrlCurrency.SetProperty("FontColor", "#ff0000");
CtrlCurrency.SetProperty("FontSize", "12");
CtrlCurrency.SetProperty("FontStyle", "Bold");
}//end else
}


Siebel Browser Script

This snippet of code produces a text box whenever the user selects a closed record ::[:::]::
_____________________________ ::[:::]::
function Applet_ChangeRecord ()
{
var BCServReq = this.BusComp();
var StatusString = BCServReq.GetFieldValue("Status");
if (StatusString == "Closed")
{
TheApplication().SWEAlert("This case is closed.")
}
}

siebel Browser Script

Create new record when the parent field is updated ::
Siebel Browser Script:::
_______________________________________:::

function Applet_ChangeFieldValue (field, value)

{

if (field == "Status")

{

var Svc = TheApplication().GetService("Workflow Process Manager");

var Input = TheApplication().NewPropertySet();

var Output = TheApplication().NewPropertySet();

var Bo = TheApplication().ActiveBusObject();

var Bc = Bo.GetBusComp("Employee");

var RowId = Bc.GetFieldValue("Id");

var sStatus = Bc.GetFieldValue("Status");

if (sStatus != "")

{

Input.SetProperty("ProcessName", "Recruit Activity Automatically Generate");

Input.SetProperty("Object Id", RowId);

Input.SetProperty("Activity Type", sStatus);

Svc.InvokeMethod("RunProcess", Input, Output);

Bo =null;

Bc =null;

RowId =null;

}

}

}