10-04-2012 09:59 AM
Hello All,
I am working on a c# plugin that will create opurtinities based on invoices created in another DB. I have the c# query working fine and have managed to kludge together a way to insert a new oppurtinty into ACT. So now I am trying to associate a product with this opportunity. Are products/services unique to each opportunty? Should'nt I be able to ask ACT for a list of the list of existing products and services the same way that I use GetStages("Commitment to Buy")? How do I do that?
Here is what I have so far:
// Create a new Oppurtinty
OpportunityManager OppMan = new OpportunityManager(this.application.ActFramework);
Stage[] stages = this.application.ActFramework.StageManager.GetStages("Commitment to Buy");
Opportunity o = OppMan.CreateOpportunity("", OpportunityStatus.Open, stages[0], DateTime.Now.AddDays(-1), false);
// Find product
o.Update();
//end Create a new Oppurtinty
Thanks and Kindest Regards
10-04-2012 01:26 PM
Hi Philz,
You should be able to simply call on the ProductManager and GetProducts() method:
ActFramework.Products.GetProducts(sortCriteria); which will return a ProductList collection from which you can itterate through.
HTH.
10-04-2012 01:26 PM
Hi Philz,
You should be able to simply call on the ProductManager and GetProducts() method:
ActFramework.Products.GetProducts(sortCriteria); which will return a ProductList collection from which you can itterate through.
HTH.
10-05-2012 11:00 AM
@vivek wrote:Hi Philz,
You should be able to simply call on the ProductManager and GetProducts() method:
ActFramework.Products.GetProducts(sortCriteria); which will return a ProductList collection from which you can itterate through.
HTH.
Thank you!
To summise for others my snippet looks like this and executes sucessfully:
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);
SortCriteria[] sortCriteria = null;
ProductList prod = this.application.ActFramework.Products.GetProducts(sortCriteria);
string s = prod[0].ToString();
MessageBox.Show(s);
o.Update();