Siebel

Everything you want to know about Siebel !!!

Pulling MVG Field Value through Scripting

In Accounts > Opportunity,  when you create a new opportunity, if Account’s primary contact’s first name and last name should pre-default in opportunity and last Name is a MVG field too then
the following script in Opportunity BC, BusComp_NewRecord can be used to achieve the necessary scenario.

function BusComp_NewRecord ()
{
var AccBO = TheApplication().GetBusObject(“Account”);
var OppBC = AccBO.GetBusComp(“Opportunity”);
var AccBC = AccBO.GetBusComp(“Account”);
var AccId= this.GetFieldValue(“Account Id”);
var ParentBC = this.ParentBusComp();
if (ParentBC != null)
{
if(ParentBC.Name() == “Account”)
{
with(AccBC)
{
ClearToQuery();
SetViewMode(GroupView);
ActivateField(“Account Id”);
ActivateField(“Primary Contact Id”);
SetSearchSpec(“Id”, AccId);
ExecuteQuery(ForwardOnly);
if (FirstRecord())
{
var Cont = AccBC.GetFieldValue(“Primary Contact Id”);
}
}
if (Cont != null)
{
var oMVGBC = this.GetMVGBusComp(“Key Contact Last Name”);
var oAssocBC = oMVGBC.GetAssocBusComp();
with(oAssocBC)
{
ClearToQuery();
SetSearchSpec(“Id”, Cont);
ExecuteQuery(ForwardOnly);
if (FirstRecord())
Associate(NewAfter);

}
oMVGBC.WriteRecord();
}
}
}
}

July 17, 2008 - Posted by Narayan Patro | Scripting | | 2 Comments

2 Comments »

  1. How can we achieve through configuration.

    Comment by Chandrashekar .H | December 18, 2008 | Reply

  2. hai iam visnu iam regular reader from last few days. I need information setting a field readonly depending on another f

    field with few example. Thank you for u

    Comment by vishnu | February 1, 2009 | Reply


Leave a comment