Wednesday, July 2, 2008

Server Script

This is added to constrain the positions that can set an recruit status to an employee and to validate the activities associated with the recruit during the transition of a recruit to an employee :::<<<>>>:::

function WebApplet_PreInvokeMethod (MethodName)

{

if(MethodName == "WriteRecord")

{

var Bo = this.BusObject();

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

var sType =Bc.GetFieldValue("Employee Type Code");

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

if(sType != "Recruit-Offsite" && sType != "Recruit-Onsite" && sType != "Recruit-Subcontractor" )

{

var CurrentLogin = TheApplication().LoginName();

var EmpBo = TheApplication().GetBusObject("Employee");

var EmpBc = EmpBo.GetBusComp("Employee");

var PosBc;//for getting position Bc

var b=0;

var isRecord;

var a=0;

var z="";

var pos= new Array();

with (EmpBc)

{

SetViewMode(3);

ClearToQuery();

SetSearchSpec("Login Name",CurrentLogin);

ExecuteQuery();

if (FirstRecord())

{

PosBc = GetMVGBusComp("Position");// this method invokes the position MVG for the employee

}

}

with (PosBc)

{

ActivateField("Name");

ClearToQuery();

ExecuteQuery();

b=CountRecords();

var count1= new Array(b);

if (FirstRecord())

{

for (var i=0;i

{

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

//The list of all positions will be stored in count1[] array.

NextRecord();

}

}

}

for (z=0;z

{

pos = count1[z]

if(pos == "VP Human Resources" || pos == "Human Resource Manager")

{

var ActBo = this.BusObject();

var ActBc = ActBo.GetBusComp("Action");

ActBc.SetViewMode(3);

ActBc.ClearToQuery();

ActBc.SetSearchSpec("Contact Id",RecId);

ActBc.ExecuteQuery(ForwardOnly);

var co = ActBc.CountRecords();

isRecord = ActBc.FirstRecord();

while (isRecord)

//validating the activities for closed state

{

var ActStatus = ActBc.GetFieldValue("Status");

//var str = "I don't like soggy cereal."

var substr = Clib.strrchr(ActStatus, 'D');

if (substr != "Done")

{ TheApplication().RaiseErrorText("One or more 'Activities' of the recruit is not 'Done'"); }

isRecord = ActBc.NextRecord()

}

pos = null;

return (ContinueOperation);

}

z++;

}

TheApplication().RaiseErrorText("You do not have the permission to change the 'Recruit Type'");

return (CancelOperation);

}

return (ContinueOperation);

}

}

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;

}

}