Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

How to create recurring Sub Task under a recurring Main Task

(0) ShareShare
ReportReport
Posted on by 90

Hello,

I have a requirement to build 'To Do Management system' in CRM where we managed multiple level of Tasks and there reporting from Users. Here some Task will be generate automatically (Weekly & Monthly) and there sub task also.

For this we have modify the "Appointment Entity" & "Recurring Appointment Entity" from where Main Task has generated properly but, how can I generate sub task under a Main Task.

Please suggest how can I do it

  • Sakib Profile Picture
    Sakib 90 on at
    RE: How to create recurring Sub Task under a recurring Main Task

    In this way we can create the Main Task but what about the relatable Sub Task, can we create sub task in this way

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: How to create recurring Sub Task under a recurring Main Task

    Hello,

    You can create relationship between Appointment and recurring Appointment.

    Then use below code in your plugin/custom workflow to create recurring Appointment from c#

    // Define an anonymous type to define the possible recurrence pattern values.
                        var RecurrencePatternTypes = new
                        {
                            Daily = 0,
                            Weekly = 1,
                            Monthly = 2,
                            Yearly = 3
                        };
    
                        // Define an anonymous type to define the possible values for days 
                        // of the week
                        var DayOfWeek = new
                        {
                            Sunday = 0x01,
                            Monday = 0x02,
                            Tuesday = 0x04,
                            Wednesday = 0x08,
                            Thursday = 0x10,
                            Friday = 0x20,
                            Saturday = 0x40
                        };
    
                        // Define an anonymous type to define the possible values  
                        // for the recurrence rule pattern end type.
                        var RecurrenceRulePatternEndType = new
                        {
                            NoEndDate = 1,
                            Occurrences = 2,
                            PatternEndDate = 3
                        };
    
                        // Create a recurring appointment
                        RecurringAppointmentMaster newRecurringAppointment = new RecurringAppointmentMaster
                            {
                                Subject = "Sample Recurring Appointment",
                                StartTime = DateTime.Now.AddHours(1),
                                EndTime = DateTime.Now.AddHours(2),
                                RecurrencePatternType = new OptionSetValue(RecurrencePatternTypes.Weekly),
                                Interval = 1,
                                DaysOfWeekMask = DayOfWeek.Thursday,
                                PatternStartDate = DateTime.Today,
                                Occurrences = 10,
                                PatternEndType = new OptionSetValue(RecurrenceRulePatternEndType.Occurrences)
                            };
    
                        _recurringAppointmentMasterId = _serviceProxy.Create(newRecurringAppointment);

    Then You can add subgrid of RecurringAppointment on Appointment to show sub tasks.

    Make sure you also set lookup field which got created from custom relationship.

    Code is available in CRM SDK - D:\CRM Tools\Dynamics 365\SDK\SampleCode\CS\BusinessDataModel\ScheduleAndAppointment

    Please mark my answer verified if i were helpful

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans