Community
Showing results for 
Search instead for 
Do you mean 
Reply

Recuring Activity

Accepted Solution Solved
Copper Super Contributor
Posts: 478
Country: Australia
Accepted Solution

Recuring Activity

Hi Everyone

 

I have been setting up workflow buttons that then create a set of activities that need to be done

 

However i cant appear to work out how to do the recuring status of an activity, most of recuring activities are 12 months, monthly or fortnightly, none of it works

 

Any help? my code is below the activity is created perfectly just the bottom bit will not work

 

 

                    string regarding = LifeComp + " Life Risk Ann - Review Check";
                    string details = "Check existing policy terms and conditions and review the clients needs for the coverage, cost difference, and features or updates in the last 12 months.\n\n Details: \n\n";
                    string location = "Office";

                    aTemplate = Act.UI.ActApplication.Instance.ActFramework.Activities.CreateActivity(a);
                    aTemplate.ActivityContacts.Add(c);
                    aTemplate.StartTime = System.DateTime.Now.AddYears(1);
                    aTemplate.EndTime = aTemplate.StartTime.AddMinutes(30);
                    aTemplate.Regarding = regarding;
                    aTemplate.Location = location;
                    aTemplate.Details = details;
                    aTemplate.Priority = Act.UI.ActApplication.Instance.ActFramework.Activities.GetActivityPriority("Medium");
                    // aTemplate.RecurSpec.Period = ActivityRecurPeriod.Yearly;

                    // recurSpec.Period = ActivityRecurPeriod.Daily;
                    // recurSpec.Modifier = ActivityRecurModifier.None;
                    // recurSpec.DayType = ActivityRecurDayType.Typed;
                    // recurSpec.Month = 0;
                    // recurSpec.Frequency = 4;

                    //for Daily - every day
                    //recurSpec.Day = new ActivityRecurDay( ActivityRecurTypedDay.Day );

                    //for Daily - every weekday
                    // recurSpec.Day = new ActivityRecurDay( ActivityRecurTypedDay.Weekday );

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6

Accepted Solutions
Solution
Accepted by topic author JasonD
‎09-25-2015 03:20 AM
Copper Super Contributor
Posts: 86
Country: United_Kingdom

Re: Recuring Activity

My colleague and I think that somehow we've managed to save an activity with an invalid recurspec into the database despite the safeguards. When the Task List encounters this invalid activity it causes it to quietly crash and not load anything. When you apply a filter which hides the invalid activity they all load fine.

 

This is a difficult one because there's not really a way to find specifically which activity it is without some luck.

Normally we have to perform a blanket reset of all recurring activities to fix the issue.

 

Is this dummy data that you've been testing on, or is this a live database?

____________________________________________________________

Unfortunately I no longer work for Swiftpage International. Please do not send any queries to this account.

View solution in original post


All Replies
Copper Super Contributor
Posts: 478
Country: Australia

Re: Recuring Activity

Anyone out there who can help????

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6
Copper Super Contributor
Posts: 86
Country: United_Kingdom

Re: Recuring Activity

Hi Jason,

 

Apologies for a late reply. For some reason I didn't receive my usual e-mail notification about this thread.

 

Can you please be a bit more specific about what doesn't work?

What happens exactly? Is there an error thrown? If so, what is the error?

 

Here's a quick example in case this helps solve the problem:

 

// DUMMY DETAILS TO USE
string regarding = "REGARDING";
string details = "DETAILS";
string location = "LOCATION";

// ASSIGNING MY RECORD AS A DUMMY
Contact c = actApp.ActFramework.Contacts.GetMyRecord();

// CREATE THE ACTIVITY TEMPLATE OBJECT
ActivityTemplate aTemplate = Act.UI.ActApplication.Instance.ActFramework.Activities.CreateActivity(StandardActivityType.Call);

// CHANGE SOME PROPERTIES OF THE TEMPLATE, I'VE PUT DUMMY VALUES
aTemplate.ActivityContacts.Add(c);
aTemplate.StartTime = System.DateTime.Now;
aTemplate.EndTime = aTemplate.StartTime.AddMinutes(30);
aTemplate.Regarding = regarding;
aTemplate.Location = location;
aTemplate.Details = details;
aTemplate.Priority = Act.UI.ActApplication.Instance.ActFramework.Activities.GetActivityPriority("Medium");

// CREATE NEW RECURSPEC BY CLONING THE DEFAULT
ActivityRecurSpec recurSpec = (ActivityRecurSpec)aTemplate.RecurSpec.Clone();

// ALTER SOME PROPERTIES OF THE RECURSPEC AS NEEDED
...
recurSpec.Period = ActivityRecurPeriod.Yearly;
... etc etc

// ASSIGN THE RECURSPEC BACK TO THE TEMPLATE
aTemplate.RecurSpec = recurSpec;

// SAVE THE ACTIVITY
aTemplate.Update();

Kind regards,

 

Sam.

____________________________________________________________

Unfortunately I no longer work for Swiftpage International. Please do not send any queries to this account.
Copper Super Contributor
Posts: 478
Country: Australia

Re: Recuring Activity

Oh Sam 3 lines, i will be ticked and happy at the same time if that works Smiley Happy

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6
Copper Super Contributor
Posts: 478
Country: Australia

Re: Recuring Activity

Year, Month, Day parameters describe an unrepresentable DateTime

Let me play around with it as i think you got me back on the right track

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6
Copper Super Contributor
Posts: 478
Country: Australia

Re: Recuring Activity

Ok Sam its ticking me off now, i have worked out most of the settings but it still comes up with date issues, mainly around the .Day variable, i can do some of the Day variables like the .Modifier, and i can name a day

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6
Copper Super Contributor
Posts: 86
Country: United_Kingdom

Re: Recuring Activity

Here is how I set the recur spec for a monthly recurring activity that happens on the 10th of every month.

There are some unused properties which I have left in so that you know what they are.

 

// OCCURS ON 10TH OF EVERY MONTH
ActivityRecurDay activityRecurDay = new ActivityRecurDay(10);
recurSpec.DayType = ActivityRecurDayType.Numbered;
recurSpec.Day = activityRecurDay;

// WHICH MONTH TO RECUR ON, USED FOR YEARLY ACTIVITIES
// recurSpec.Month = 1;

// HAS AN END DATE
recurSpec.IsEndless = false;
recurSpec.EndDate = DateTime.Now.AddYears(1);

// OCCURS EVERY 1 MONTH
recurSpec.Period = ActivityRecurPeriod.Monthly;
recurSpec.Frequency = 1;

// USED WITH NAMED DAYS, LETS YOU SPECIFY "EVERY THIRD THURSDAY" FOR EXAMPLE
// recurSpec.Modifier = ActivityRecurModifier.None;

You can check a valid recurspec before applying it and saving the activity (the true flag tells the utility to fix a broken spec, can be set to false if you want to manually do it):

 

if (ActivityRecurUtility.ValidateRecurSpec(recurSpec, true))
{
    aTemplate.RecurSpec = recurSpec;

    try
    {
        aTemplate.Update();
    }
    catch
    {
        throw;
     }
}
else
{
    // INVALID RECUR SPEC
}

Hope this helps.

 

Sam.

____________________________________________________________

Unfortunately I no longer work for Swiftpage International. Please do not send any queries to this account.
Copper Super Contributor
Posts: 478
Country: Australia

Re: Recuring Activity

Thanks for that Sam it looks all good and compiles but when i run it it does not work still says .Day not set, even though it clearly is

Also since i started messing around with this code my Task List view does not show anything, when i alter the filter it comes back but not the To-Dos which is what my code is playing with, are the two related??? all the to-dos are still there in each client but not in the Task List

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6
Copper Super Contributor
Posts: 478
Country: Australia

Re: Recuring Activity

could it not be loading the new build?

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6
Copper Super Contributor
Posts: 86
Country: United_Kingdom

Re: Recuring Activity

I'm not sure why it wouldn't work for you, the code is copied directly from a working example of mine that I re-tested this morning.

Here is the full example just in case there's something different. This definitely creates a recurring activity with no issues.

 

string regarding = "REGARDING";
string details = "DETAILS";
string location = "LOCATION";

Contact c = actApp.ActFramework.Contacts.GetMyRecord();

ActivityTemplate aTemplate = Act.UI.ActApplication.Instance.ActFramework.Activities.CreateActivity(StandardActivityType.Call);

aTemplate.ActivityContacts.Add(c);
aTemplate.StartTime = System.DateTime.Now;
aTemplate.EndTime = aTemplate.StartTime.AddMinutes(30);
aTemplate.Regarding = regarding;
aTemplate.Location = location;
aTemplate.Details = details;
aTemplate.Priority = Act.UI.ActApplication.Instance.ActFramework.Activities.GetActivityPriority("Medium");

ActivityRecurSpec recurSpec = (ActivityRecurSpec)aTemplate.RecurSpec.Clone();

// OCCURS ON 10TH OF EVERY MONTH
ActivityRecurDay activityRecurDay = new ActivityRecurDay(10);
recurSpec.DayType = ActivityRecurDayType.Numbered;
recurSpec.Day = activityRecurDay;

// WHICH MONTH TO RECUR ON, USED FOR YEARLY ACTIVITIES
// recurSpec.Month = 1;

// HAS AN END DATE
recurSpec.IsEndless = false;
recurSpec.EndDate = DateTime.Now.AddYears(1);

// OCCURS EVERY 1 MONTH
recurSpec.Period = ActivityRecurPeriod.Monthly;
recurSpec.Frequency = 1;

// USED WITH NAMED DAYS, LETS YOU SPECIFY "EVERY THIRD THURSDAY" FOR EXAMPLE
// recurSpec.Modifier = ActivityRecurModifier.None;
            
if (ActivityRecurUtility.ValidateRecurSpec(recurSpec, true))
{
    aTemplate.RecurSpec = recurSpec;

    try
    {
        aTemplate.Update();
    }
    catch
    {
        throw;
    }
}
else
{
    // INVALID RECUR SPEC
}

I'm not aware of any issues that cause the Task List to go blank, although it sounds like too much of a coincidence to not be related.

It sounds like there's maybe a To-Do in there that is broken so when it encounters an error it fails to render the list.

I'm not sure how you'd go about fixing this one. I'd start by backing up the database and then running the standard repairs through Tools > Database Maintenance > Check and Repair database.

 

Kindest regards,

 

Sam.

 

____________________________________________________________

Unfortunately I no longer work for Swiftpage International. Please do not send any queries to this account.