Community
Showing results for 
Search instead for 
Do you mean 
Reply

Activity Template and ActivityID field

Astute Commentator
Posts: 168
Country: United States

Activity Template and ActivityID field

When one creates an Activity, one uses the Activity Template object. This object has the ActivityID field which identifies is what it is. This Id is created when the template is saved i.e. aActivityTemplate.Update

 

However, the ActivityID field for the Activity Template is DIFFERENT from the ActivityId of the resulting Act! Activity.

 

The question is: How does one create an Activity using the Activity Template and then retrieve the resulting Activity's correct ActivityID field? Of course, without having to search through the activities table which is really time consuming.

 

I want to save the activity and then retrieve it by the ActivityId. Any suggestions?

 

T

Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Activity Template and ActivityID field

 event

 

Are you sure the ActivityTemplate.ActivityId changes?  I see the same ID on the ActivityCreateComplete

Add an ActivityCreateComplete handler, then when saving the activity template aActivityTemplate.Update the ActivityCreateComplete

 

AddHandler HostFramework.Activities.CreateActivityComplete, AddressOf ActivityCreateComplete

 

 

Private Sub ActivityCreateComplete(ByVal ActivityTemplate As Act.Framework.Activities.IActivity)
     '----------------------------------------------
     ' 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)

End Sub

 

 

-- Jim Durkin

Astute Commentator
Posts: 168
Country: United States

Re: Activity Template and ActivityID field

Thanx for the info.

 

The ActivityID of the template is different from the actual created activity. On some versions of Act! it is the same while on others, it is different. On V18, it is different. Beats the heck of me why anyone would code this to be different! It is just sooo bizarre.

 

The thing is, the ActivityId of the template does not exist in the Act! Activities Database. So searching the Activities database for the GUID returns null. The activity  exists and is created. However, it has a different ActivityId.

 

Am I missing something?

 

T

Nickel Contributor
Posts: 175
Country: USA

Re: Activity Template and ActivityID field

Is it possible that the Activity hasn't been committed to the database yet? I know in generic .NET, the datatable has it's own unique identifier/key until it gets committed to the database and the database returns its identifier/key.

But, re-reading your post, it would make sense to me that the ID of the template is different than the ID of the activity created. Once the activity is created, it should be different, due to the different values. I could be way off on both of these, so take 'em with a grain of salt.
Astute Commentator
Posts: 168
Country: United States

Re: Activity Template and ActivityID field

I think what you are stating is correct.

 

The question stil is "How can one get the ActivityId of the created activity from the activity template"? Shouldn't the Activity Template object return the Activity that it has just created so that one can identify/modify/record it? That would be the logical thing to do. However, that is not the case. Once the activity is created, it detaches itself from the Template. To access it, you must search for it on the Activities table (not a reliable way of doing it).  There must be a better way to do this....

 

Swiftpage used to have an email address for developers where you could ask these questions. However, emails sent to that address now go unanswered.

 

Any clues?

 

T