01-20-2010 02:28 AM
Hello,
We are trying to add Activities to ACT! programatically. We are able to succeed in Adding activies to the specific contact in ACT!, but alarm is not popping up in the respective time set.
Here is the code snippet we tried out..
Act.Framework.ActFramework ACTFM
Contact newContact
ActivityType aType;
aType = ACTFM.Activities.GetActivityType("Call");
// Create a new activity - default organizer to the logged in user
ActivityTemplate NewActivity = ACTFM.Activities.CreateActivity();
// Get a calendar delegate grantor by ID.
User[] theActiveUsers = ACTFM.Users.ActiveUsers;
CalendarDelegateGrantor cdg1 = ACTFM.CalendarDelegates.GetCalendarDelegateGrantorByAccessorId(theActiveUsers[theActiveUsers.Length - 1].ID);
if (cdg1 != null)
{
// Update the organizer
NewActivity.Organizer = cdg1;
// Do whatever else you need (Add contacts, set regarding, etc...) then call .Update() to save it
NewActivity.ActivityContacts.Add(newContact);
NewActivity.Regarding = "New Activity Regarding";
NewActivity.StartTime = DateTime.Now.AddMinutes(1);
NewActivity.EndTime = DateTime.Now.AddMinutes(6);
NewActivity.Type = aType;
NewActivity.IsAlarmed = true;
NewActivity.LeadMinutes = 5;
NewActivity.Update();
}
Note:
After adding the activity to ACT! programatically, If we open up the Activity manually once and then close it up.
Alarm is Popping up in ACT!
Thx in Advance.
01-20-2010 02:22 PM
Not trying to be thick here but that sounds correct. The alarm should pop up based on your code.
You are setting an activity to be schedule in 1 minutes and the lead time of the alarm is 5 minutes.
That means that the alarm is four minutes overdue. So when you open and close the alarm pops up.
Try setting the activity for an hour in the future. Does the alarm popup in 55 minutes?
NewActivity.StartTime = DateTime.Now.AddMinutes(60);
NewActivity.EndTime = DateTime.Now.AddMinutes(65);
-- Jim Durkin
01-22-2010 06:04 AM
Hello Jim,
Thanks for ur suggestion..
This time I have tried with different Input, but still alarm didn't popup. As I mentioned earlier. If i open the activity manually once & close it it pops up at the right time.
NewActivity.StartTime = DateTime.Now.AddMinutes(10);
NewActivity.EndTime = DateTime.Now.AddMinutes(15);NewActivity.LeadMinutes = 5;
=> I have also received the following error at times.
Task Scheduler Service
"Some task did not execute at their scheduled time because the Task Scheduler serivce was not running. You can view the list of of missed tasks, and attempt to run them again, from within the scheduled Tasks folder."
Should is start any service, if so how is it working, if i open the activity manually & close it once.
Thanks for the help!