01-21-2016 08:12 PM
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?
01-22-2016 04:48 AM
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)
-- Jim Durkin
01-22-2016 09:08 AM
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?
01-22-2016 02:22 PM
01-22-2016 02:39 PM
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.