Community
Showing results for 
Search instead for 
Do you mean 
Reply

How to update Opportunities via ActFramework?

Tuned Listener
Posts: 5
Country: Netherlands

How to update Opportunities via ActFramework?

I would like to update the ActFramework opportunities.

I created some code, but I don't know how to synchronise changes to the database.

This is an example of my code:

 

    ActFramework framework = _application.ActFramework;
    OpportunityList oList = framework.Opportunities.GetOpportunities(null);
    foreach (Opportunity oOpp in oList)
    {
      oOpp.Status = OpportunityStatus.Open;
    }

 

Object oOpp has Status open, but how do I synchronise this change?

Does anyone know how to get this done?

Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: How to update Opportunities via ActFramework?

Hiya Geert,

 

Try this:

 

 ActFramework framework = _application.ActFramework;

    OpportunityList oList = framework.Opportunities.GetOpportunities(null);
    foreach (Opportunity oOpp in oList)
    {
      oOpp.Status = OpportunityStatus.Open;

    oOpp.Update(); //updates any pending changes.

    }

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

Re: How to update Opportunities via ActFramework?

Hi Vivek,

 

Thanks for the response.

I tried to build it, but oOpp only has functions UpdateContacts() and UpdateProducts().

Update() does not compile.

 

I took another look at the Actframework.

I found that if I have an Opportunity that inherits from class MutableEntity, then it has Update().

Now the question is how to get there?

Nickel Super Contributor
Posts: 352
Country: Canada

Re: How to update Opportunities via ActFramework?

I'm a little rusty on it but you used to use .SetStatus() which is now depricated.  I believe the supported way to do it is with .SetOpportunityField(int index, object value) and no Update() call is required when you use that method.
Len Kamerman
ACT! Certified Consultant

Act E-mail Marketing Trainining Course:

http://actsoftware.training
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: How to update Opportunities via ActFramework?

Hi Geert,

 

Hmm that's a bit weird!

 

Which version of ACT! are you using and which version of Act.Framework.dll are you using? The reason I ask this is that looking through my SDKs I can see that the ACT! 2008 SDK has a UpdateContacts() and UpdateProducts() but no Update().

 

In ACT! 2010 Opps as you most probably know are now fully formed Primary Entities and inherit from the  Act.Fraemwork.MutableEntities.MutableEntity Object. In ACT! 2008 Opps inherit from Act.Framework.Entities.Entity Object which does not have a Update().

 

Maybe your using an 2008 Act.Framework reference?

 

 

 

 

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

Re: How to update Opportunities via ActFramework?

Hi Vivek,

 

Oops, my fault, I forgot to mention that I'm still using ACT! 2008,

so that is why I'm using an 2008 Act.Framework reference.

Tuned Listener
Posts: 5
Country: Netherlands

Re: How to update Opportunities via ActFramework?

Hi Len,

 

As far as I know this function only addresses the 8 user fields.

Like the remark of this function in the 2008 Act.framework says:

 

"Use SetOpportunityField to populate any of the eight Opportunity User fields.
SetOpportunityField's field index parameter is zero based.  Valid values for
the field index parameter are 0 - 7."

 

Thanks any way.