Community
Showing results for 
Search instead for 
Do you mean 
Reply

Capture Save Event

Tuned Listener
Posts: 16
Country: Australia

Capture Save Event

Hi,

 

I have never writting a plug in before, and I am looking to write small simple one.

 

Bascially I have a custom field in the opportunity panel, when user hit 'save' button for opportunity; if the value of this custom field is 'A', lets the system save as normal. if custom fields is 'B', display MessageBox and do not save.

 

How do I capture the save event? any help would be appreciated.

Employee
Posts: 1,163
Country: USA

Re: Capture Save Event

[ Edited ]

Opportunities have an Updated event that you could monitor.

Message Edited by mwood on 06-11-2010 06:34 AM
Matthew Wood
Act! SDK Support
Community Moderator
Nickel Elite Contributor
Posts: 937
Country: USA

Re: Capture Save Event

What version of ACT! are you writing this plugin for?  
Tuned Listener
Posts: 16
Country: Australia

Re: Capture Save Event

Hi,

 

I am using ACT! Sage Premium 2010,

 

Do you have a couple lines of sample code?

Nickel Elite Contributor
Posts: 937
Country: USA

Re: Capture Save Event

Just a suggestion - instead of a plugin you might want to consider implementing this as a custom control.  You can write a control that self validates or tests for value on exit.  Check out the Dynamic Label Control I posted on devnet downloads for a conceptual example of this.  It shows how you can test for values of a field then change the control based on those values.  You will need to write your own field write-back if you use that control as an example, but that's not especially difficult.

 

There's another example called Opportunity example control I believe on devnet downloads that shows a custom control for Opportunities in ACT! 2010 or higher - you need to use the IMutableEntity interface for Opportunities so that's a good example of that.

 

 

Tuned Listener
Posts: 16
Country: Australia

Re: Capture Save Event

Thanks alduet, but one thing I need is; on before save event, how do I capture that? Basically, when the user hit 'Save' opportunity button,I want to display the error and do no want to save the record.

 

Any help would be appreciated.

 

Thanks in advance.

Employee
Posts: 1,163
Country: USA

Re: Capture Save Event

I'm thinking that when the save buttons is hit may not be the best event to monitor, there is an Upated event but I'm not sure how we'd halt the commit at that point.

 

We can capture the currentOpportunity from the application state and then monitor your field for changes.

Matthew Wood
Act! SDK Support
Community Moderator