GetAssocBusComp Method
The GetAssocBusComp method returns an instance of the association business component. It uses the following syntax:
BusComp.GetAssocBusComp();
It includes no arguments.
For more information, see Associate Method.
You can use an association business component to manipulate an association. You can use the GetAssocBusComp method and the Associate method only with a many-to-many relationship that uses an intersection table. For example, with accounts and contacts.
Note the following:
To associate a new record, you add it to the child business component.
To add a record, you use the GetAssocBusComp method and the Associate method.
If a many-to-many link exists, and if Siebel CRM defines an association applet for the child applet, then you can use the GetAssocBusComp method with the child business component of a parent-child view.
Example of Using the GetAssocBusComp Method
The following example associates a contact that includes the ContactID Id with an account that includes the AccountId Id:
var currRetValue={err:false}, retObj;
var Model =SiebelApp.S_App.GetModel()
varaccount BO = Model.GetBusObj("Account");
var accountBC = accountBO.GetBusComp("Account");
var contactBC = accountBO.GetBusComp("Contact");
accountBC.SetSearchSpec("Id",[AccountId]);
currRetValue=accountBC.ExecuteQuery ();
currRetValue=accountBC.FirstRecord();// positions on the account record
currRetValue=contactBC.ExecuteQuery ();
currRetValue=contactBC.FirstRecord();
var assocBC = contactBC.GetAssocBusComp();
assocBC.SetSearchSpec("Id",[ContactID]);
currRetValue=assocBC. ExecuteQuery ();
currRetValue=assocBC.FirstRecord();// positions on the contactbc
currRetValue=contactBC.Associate(); // adds the association