Community
Showing results for 
Search instead for 
Do you mean 
Reply

Programatically returning the existing list of products/services

Accepted Solution Solved
Tuned Listener
Posts: 5
Country: USA
Accepted Solution

Programatically returning the existing list of products/services

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

 


Accepted Solutions
Solution
Accepted by topic author philz
‎09-25-2015 03:20 AM
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Programatically returning the existing list of products/services

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.

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog

View solution in original post


All Replies
Solution
Accepted by topic author philz
‎09-25-2015 03:20 AM
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Programatically returning the existing list of products/services

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.

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
Tuned Listener
Posts: 5
Country: USA

Re: Programatically returning the existing list of products/services


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