Community
Showing results for 
Search instead for 
Do you mean 
Reply

Creating a new Opportunity with existing products

Tuned Listener
Posts: 5
Country: USA

Creating a new Opportunity with existing products

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();

Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Creating a new Opportunity with existing products