Hi All,
I know there's been a lot of questions about creating a BO instance, so I thought I would provide you with an example from one of my projects. Some code is omitted to protect my Customer.
In this script I am checking if a Customer already exists matching my custom User BO. If not, I create an instance of the the Customer BO filled with elements from my custom BO. Anyway, I hope this helps.
// Get customers in User BO
query_customer = Customer.QueryByIdentification;
query_customer_selparam = query_customer.CreateSelectionParams();
query_customer_selparam.Add(query_customer.InternalID , "I", "EQ", this.UserID);
query_customer_result = query_customer.Execute(query_customer_selparam);
// If Customer does not exist, create Customer
if (query_customer_result.Count() == 0) {
var customerRoot : elementsof Customer;
customerRoot.CategoryCode = "2"; // or 1 or 3
customerRoot.InternalID = this.UserID;
CustomerBO = Customer.Create(customerRoot);
//Customer Indicator
CustomerBO.CurrentBusinessCharacters.CustomerIndicator = true;
CustomerBO.CurrentBusinessCharacters.ProspectIndicator = false;
//Organisation
CustomerBO.CurrentCommon.Organisation.Name.FirstLineName = this.UserName.content; CustomerBO.CurrentCommon.Organisation.Name.SecondLineName = "";
CustomerBO.Activate();
}