Find source of activity update

I have code which is launched in the OnSaving event and if certain conditions are met, adds data to the current activity before saving. If the activity was updated from the Activity page then after saving but before closing the activity I want to be able to display the additional data. If the activity was completed from the Account or Contact entity then there is no requirement to refresh. Can I find out from where the Activity update is being triggered ?

Like 0

Like

1 comments

Hi,

Inside the OnSaving event, you can get a StackTrace of this event, however, you won't be able to distinguish at what object it was performed because the event itself starts from the same point.

To understand from where your activity was saved you can add a special column to it which will contain information about the save process and read it inside your OnSaving event.

For example, create a boolean column IsFromActivity page, set its default value to false and override method save() inside ActivityPageV2 and there set the value to true. Then inside OnSaving whit this column you can understand where this Activity was saved.

Show all comments