Community
Showing results for 
Search instead for 
Do you mean 
Reply

ActivityManager's CreateActivityComplete event is not fired.

Highlighted
Copper Contributor
Posts: 189
Country: Netherlands

ActivityManager's CreateActivityComplete event is not fired.

I need the CreateActivityComplete event to fire when an activity is created, for an Act! add-on.

But this event is never fired. 

I've already mentioned this a few years ago in this unanswered topic: https://community.act.com/t5/Act-Developer-s-Forum/Activity-not-found-after-creating-it/m-p/319306/h...

 

Please have a look at this.

 

My code:

 

private void IPlugin.OnLoad(ActApplication application)
{
            // hold on to the application
            actApplication = application;

            // be sure to keep track of when a user logs in or is logged out
            Controller.Instance.actApp.AfterLogon += new EventHandler(Application_AfterLogon);
            Controller.Instance.actApp.BeforeLogoff += new EventHandler(Application_BeforeLogoff);

}

private void Application_AfterLogon(object sender, EventArgs e)
{
        actApplication.ActFramework.Activities.CreateActivityComplete += Activities_CreateActivityComplete;
}


private void Activities_CreateActivityComplete(Act.Framework.Activities.IActivity activity)
{
        // never reaches this!
}
Greetings,

ACT Certified Consultants
TendenZ
the Netherlands
Bronze Super Contributor
Posts: 1,265
Country: USA

Re: ActivityManager's CreateActivityComplete event is not fired.

Here is what I use. Sorry it was back in the day I used VB.

 

 

AddHandler HostFramework.Activities.CreateActivityComplete, AddressOf ActivityCreateComplete
    Private Sub ActivityCreateComplete(ByVal ActivityTemplate As Act.Framework.Activities.IActivity)
        Try
         
            '----------------------------------------------
            ' ACT passes us an ActivityTemplate.
            ' Get the actually activity
            '----------------------------------------------
            Dim Activity As Act.Framework.Activities.Activity
            Activity = Durkin.Common.Classes.Activities.GetActivityByGuid(Me.HostFramework, ActivityTemplate.ActivityId, Act.Framework.Activities.FirstInstanceRestriction.FirstOccurrence, True)


            Dim aGuid(0) As System.Guid
            aGuid(0) = ActivityTemplate.ActivityId

            Dim cActivityList As ActivityList
            cActivityList = HostFramework.Activities.GetActivityInstancesByActivityId(aGuid)

Catch ex As Exception LogError.Write(ex, "CreateActivityComplete") End Try End Sub

 

Jim Durkin