Community
Showing results for 
Search instead for 
Do you mean 
Reply

ActFramework.Activities.CreateActivity not returning correct GUID

Highlighted
New Member
Posts: 13
Country: USA

ActFramework.Activities.CreateActivity not returning correct GUID

[ Edited ]

ActFramework.Activities.CreateActivity(StandardActivityType.ToDo) returns an ActivityTemplate object. The object contains the ActivityID GUID. This is supposed to be the same ActivityID in the database table and it has worked this way for years until it suddenly stopped working. It returns a GUID that doesn't not match the one inserted into the database, so when I go to use the ActivityID to insert an attachment, there's an error because of the foreign key constraint between the Activity and Attachment tables. The ActivityID taken from the new object is not in the Activity table at all. Any ideas?

Highlighted
Bronze Super Contributor
Posts: 1,283
Country: USA

Re: ActFramework.Activities.CreateActivity not returning correct GUID

Jeremy,

I'm still using the the ActivityCreateComplete event in the SDK with no issues.

 

    Private Sub ActivityCreateComplete(ByVal ActivityTemplate As Act.Framework.Activities.IActivity)
        Try

            '------------------------------------------------
            ' Set the Mouse cursor to our Custom WaitCursor
            '------------------------------------------------

            Windows.Forms.Cursor.Current = Cursors.WaitCursor

            '----------------------------------------------
            ' ACT passes us an ActivityTemplate.
            ' Get the actualy 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)


            '-------------------------------------------
            ' Update the "Next Action Date" field
            '-------------------------------------------
            Me.UpdateNextActionDate(Activity, Activity.IsCleared)


            '------------------------------------------------
            ' Set the Mouse cursor to our Custom WaitCursor
            '------------------------------------------------
            Windows.Forms.Cursor.Current = Cursors.Default

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

        End Try
    End Sub

Where are you seeing the issue?

 

-- Jim 

Highlighted
New Member
Posts: 13
Country: USA

Re: ActFramework.Activities.CreateActivity not returning correct GUID

This may be what I'm looking for, but what is your "Durkin" object?

 

I'm trying to find where to use GetActivityByGuid from exactly.

 

 

Highlighted
Bronze Super Contributor
Posts: 1,283
Country: USA

Re: ActFramework.Activities.CreateActivity not returning correct GUID

Its a wrapper class around the ACT SDK

 

basically it uses this method

ActFramework.Activities.GetActivityInstancesByActivityId(aGuid)

Or this one...

ActFramework.Activities.GetTaskListItems(aSort, aFilter, StartDate, EndDate, iFirstOccuranceRestriction, False)

 

-- Jim 

Highlighted
New Member
Posts: 13
Country: USA

Re: ActFramework.Activities.CreateActivity not returning correct GUID

[ Edited ]

This closest method I found is:

 

ActivityList test = theApp.ActFramework.Activities.GetActivityInstancesByActivityId(new Guid[1] { newActivityTemplate.ActivityId });

 

It uses an array of Guids though and returns an ActivityList. I couldn't find a method that finds just one. Unfortunately the count of the list is 0 though, so it didn't return anything anyway.