Community
Showing results for 
Search instead for 
Do you mean 
Reply

Opportunity Company Changed Event

Copper Contributor
Posts: 61
Country: United_Kingdom

Opportunity Company Changed Event

I'm trying to use 

 

theApp.ApplicationState.CurrentOpportunity.GetCompanies(null).AddNew

 

 

evet for when Opportunity has a new Company in itself but the event is never fired when I add new Company, I also tried 

 

theApp.ApplicationState.CurrentOpportunity.GetCompanies(null).AddNewComplete

 

event as well but same. Is there anyway to control if Opportunity has a new Company or Company list is updated?

 

Thanks

Copper Contributor
Posts: 61
Country: United_Kingdom

Re: Opportunity Company Changed Event

Guys I need your help on this I cannot use this event when there is a new Company added to Opportunity.

Employee
Posts: 1,163
Country: USA

Re: Opportunity Company Changed Event

This event is firing in my application. What version of act and when are you signing up for the event?

Matthew Wood
Act! SDK Support
Community Moderator
Copper Contributor
Posts: 61
Country: United_Kingdom

Re: Opportunity Company Changed Event

Hi Matthew, thanks for your answer my version is ACT! Premium 2012 Version 14.1.108.0

Employee
Posts: 1,163
Country: USA

Re: Opportunity Company Changed Event

Do other opportunity events work? Where are you signing up for the event (when the view loads/when the application loads)?

Matthew Wood
Act! SDK Support
Community Moderator
Copper Contributor
Posts: 61
Country: United_Kingdom

Re: Opportunity Company Changed Event

Hi Matthew, 

 

This is my code 

 

public void OnLoad(ActApplication actApp)
{
// Anchor ourselves to the running ACT! instance
theApp = actApp;
// attach delegates to event handlers so we can do work once ACT! is ready for us
theApp.AfterLogon += new System.EventHandler(this.AfterLogin);
theApp.BeforeLogoff += new System.EventHandler(this.BeforeLogoff);
theApp.AfterLogoff += new System.EventHandler(this.AfterLogoff);
this.theApp = actApp;
this.HostFramework = actApp.ActFramework;
}

private void AfterLogin(object Sender, System.EventArgs e)
{
theApp.ActFramework.Database.BeforeDatabaseLock += new Act.Framework.Database.DatabaseLockHandler(this.BeforeDatabaseLock);
theApp.ActFramework.Opportunities.AddOpportunity+=new OpportunityManager.AddOpportunityEvent(Opportunities_AddOpportunity);
theApp.CurrentCompanyChanged += new EventHandler(ActApp_CurrentCompanyChanged);
theApp.ApplicationState.CurrentOpportunity.Updated += new MutableEntity.UpdatedEventHandler(CurrentOpportunity_Updated);
theApp.CurrentOpportunityChanged += new EventHandler(ActApp_OpportunityChanged);
theApp.ApplicationState.CurrentOpportunity.GetCompanies(null).AddNewComplete+=new DataListChangeEventHandler(PrototypePlugin_AddNewComplete);

}
void ActApp_ViewLoaded(object sender, ViewEventArgs e)
{
if (theApp.CurrentViewName == "Act.UI.IOpportunityDetailView")
{
Opportunity o = theApp.ApplicationState.CurrentOpportunity;
o.Updated += new MutableEntity.UpdatedEventHandler(o_Updated);
}
}

void o_Updated()
{
MessageBox.Show("here whatever");
//Do stuff here
}
void CurrentOpportunity_Updated()
{
MessageBox.Show("here2");
}

void Opportunities_AddOpportunity(string opportunityName, Guid opportunityID)
{
MessageBox.Show("here");
}