I have done lots of scripting during Siebel development and lot of time to reduce scripting I have used this.ParentBusComp method. I will give an example to explain it better.
Requirement:
On Service Request (Service Request BC) screen we have a Activities (Action BC) as its child. On click of a ‘Done’ button on Activities Child applet the ‘Status’ field of activity should change to done and Status of ‘Service Request’ on the parent should change to ‘Activity Done’
Scripting Solution:
On PreInvoke method of Action buscomp write the following script
if (MethodName == “Done”) // Method name of the done button
{
this.SetFieldValue (“Status”, “Done”);
var BO = TheApplication().GetBusObject(“Service Request”);
var BC = BO.GetBusComp(“Service Request”)
with (BC)
{
ActivateField (“Status”);
SetViewMode (3);
SetSearchSpec (“Id”, this.GetFieldValue (“SR Id”));
ExecuteQuery ();
if (FirstRecord())
{
SetFieldValue (“SR Status”, “Activity Done”);
WriteRecord ();
}
}
}
There is a simple code that we can write to accomplish the same which goes as following
if (MethodName == “Done”) // Method name of the done button
{
this.SetFieldValue (“Status”, “Done”);
this.ParentBusComp ().SetFieldValue (“Status”, “Activity Done”);
this.ParentBusComp ().WriteRecord
}
This helps you reduce a query on parent business component. You can set the value of the fields that are on UI or that are Force Active. You will need to activate other fields.
But recently I faced a problem with this method which I am going to discuss in my next post

1 Comment at "Use this.ParentBusComp method to reduce scripting"
[...] my last post I described how we can use ParentBusComp() to reduce the amount of scripting that we have to do while updating the parent record based on some [...]
Comment Now!