10-09-2012 10:09 AM
Hello All,
I am trying to create a new opportunity and then attach an existing product from the database. This code creates the new opp and then finds our existing product using GetProduct. My question is how do I Update the products associated with this Opportunity? Also, how can I update price and quantity fields of the product?
Thank you and Kindest Regards
Phil Z.
// Create a new Opp
OpportunityManager OppMan = new OpportunityManager(this.application.ActFramework);
Stage[] stages = this.application.ActFramework.StageManager.GetStages("Commitment to Buy");
Opportunity o = OppMan.CreateOpportunity("MoreTest123", OpportunityStatus.Open, stages[0], DateTime.Now.AddDays(-1), false);
//Find our existing product
SortCriteria[] sortCriteria = null;
Product myprod = this.application.ActFramework.Products.GetProduct("2012 Trade Show Booth");
// Should I call UpdateProducts? If so, how should I call UpdateProducts?
o.UpdateProducts(new OpportunityProduct[] myprod, new OpportunityProduct[] );
o.Update();
10-09-2012 05:52 PM