Community
Showing results for 
Search instead for 
Do you mean 
Reply

Event on adding a Product to an Opportunity

Platinum Elite Contributor
Posts: 14,384
Country: Australia

Event on adding a Product to an Opportunity

Is there an Event when a Product is added or edited in an Opportunity that we can read?

 

If not, I guess we can add a field to the Products that is not Allowed Blank and that has a Field Trigger -at least this should catch new additions, but leaves some holes in our intended project

 

If there is such an event, can it be trapped in the Web interface?

 

ACT! 2010

Copper Super Contributor
Posts: 59
Country: USA

Re: Event on adding a Product to an Opportunity

Hi Mike,

 

I'm also having this problem. I need to catch an event when a product is added/edited/removed from an opportunity. Did you ever figure out a solution?

 

Thanks in advance 

Hugo Vale
Datastream Custom Solutions
http://www.datastreamcs.com
Platinum Elite Contributor
Posts: 14,384
Country: Australia

Re: Event on adding a Product to an Opportunity

Not yet...

 

Looking at trying to use a field trigger on entry to Item# and using external code ... messy, but might work.

 

Trying to work around two issues:

1. Inability to add additional fields to Master Product List

2. Inability to prevent users putting in or modifying pricing and other info

 

Appreciate anyone with useful ideas.

Tuned Listener
Posts: 14
Country: India

Re: Event on adding a Product to an Opportunity

Hi,

 Is there any way i can trigger a program when a new activity is scheduled.

Any help is appreciated.

 

Thanks in Advance.

Copper Super Contributor
Posts: 59
Country: USA

Re: Event on adding a Product to an Opportunity

If you are talking programmatically then the way to do it, is to listen for the CreateActivityComplete event, here's a vb code snippet:

 

You would add this in the AfterLogon event: 

            AddHandler actApp.ActFramework.Activities.CreateActivityComplete, AddressOf ActivityCreated

 

 

Private Sub ActivityCreated(ByVal activity As Act.Framework.Activities.IActivity)

Process.start("Application you need to start") 

End Sub 

 

Hope it helps 

Hugo Vale
Datastream Custom Solutions
http://www.datastreamcs.com
Tuned Listener
Posts: 14
Country: India

Re: Event on adding a Product to an Opportunity

Smiley Happy Thanks a lot it really worked for us.
Copper Contributor
Posts: 32
Country: United_Kingdom

Re: Event on adding a Product to an Opportunity

GLComputing, did you ever figure this one out? i'm stuck on doing this at the moment

Platinum Elite Contributor
Posts: 14,384
Country: Australia

Re: Event on adding a Product to an Opportunity

Copper Contributor
Posts: 32
Country: United_Kingdom

Re: Event on adding a Product to an Opportunity

Anyone else have any ideas?

Platinum Elite Contributor
Posts: 14,384
Country: Australia

Re: Event on adding a Product to an Opportunity

To find how we did it, I'd have to go through old source code ... but, a quick seach through some files found this. Does it help?

 

private Dictionary<OpportunityProduct, MutableEntity.FieldCollection.FieldChangedHandler> _handlers;
void OnCurrentOpportunityChanged(object sender, EventArgs e)
{
    if (_handlers != null)
    {
        foreach (KeyValuePair<OpportunityProduct, MutableEntity.FieldCollection.FieldChangedHandler> kv in _handlers)
        {
                kv.Key.Fields.FieldChanged -= kv.Value;
        }
        _handlers.Clear();
    }
    _handlers = new Dictionary<OpportunityProduct, MutableEntity.FieldCollection.FieldChangedHandler>();

    foreach (OpportunityProduct oppProduct in _application.ApplicationState.CurrentOpportunity.GetProducts(null))
    {
        MutableEntity.FieldCollection.FieldChangedHandler handler = new MutableEntity.FieldCollection.FieldChangedHandler(OnFieldsChanged);
        oppProduct.Fields.FieldChanged += handler;
        _handlers.Add(oppProduct, handler);
    }
}

void OnFieldsChanged(string fieldName)
{
    bool b = true;
}

 

 

Or, I think the ProductList class has a AddNewComplete event

 

For more than that, would need to charge for the time to research the old code