Personalized Community is here!
Quickly customize your community to find the content you seek.
Check out the latest Sales updates!Learn about the key capabilities and features of Dynamics 365 Sales and experience some of the new features.
Download overview guide | Watch Sales video
2021 Release Wave 1Discover the latest updates and new features to Dynamics 365 planned April 2021 through September 2021.
Release overview guides and videos Release Plan | Preview 2021 Release Wave 1 Timeline
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
If contact creates an activity - appointment within the current year
And the appointment has been completed in the current year
Expected Result: Then I should see a count in my YTD Appointment (roll-up field) adding one (+1) to the current count (therefore the count should increase each time the contact completes an appointment within the current year)
If the appointment was created in a previous year
Then the appointment(s) should not be included in the Roll-up field
When the year changes to 2022 then clear the YTD Appointment field to restart
Then any newly completed appointments should restart count on 1/1 of the next current year
My solution thus far is:
1. Create a YTD Appointment roll-up field: Contact - Regarding Appointments - Status = completed then Count Appointment
2. Create a field Appointment: Is Current Year? boolean
3. Create a business rule that looks at the Start Time Date
Rule: if the date falls within This Year then the flag will be true.
4. Create a plugin that grabs all completed appointments where Is Current Year is true,
Update Roll-up field with +1 for any newly completed appointments
When the current year changes then clear field on the first of the new year
Question to the D365 Group: How do I get the condition "This Year" to be available as a selection within my Roll-up field or workflow/Business rule so that I can calculate the activities within the current year?
Hello, you don't have to create a Roll-Up field, just create a Field as a number and use a plugin to accomplish all this, to get the current year use this
DateTime now = DateTime.Today;
int year = now.Year;
however, a plugin can only be triggered following an update on a field if you want your code to be triggered by a timer then you have to use an Azure function
Just to confirm: 1. configuration - create a whole number field (example YTD Appointments) 2. Create a plugin to update the YTD Appointment field when an appointment status value = complete and the DateTime (now) = DateTime.Today; int year = now.Year then add 1 to the YTD Appointment field?
yes, or if you do keep the date in which the opportunity was completed you can use a query to get the number of opportunities that were close this year,
but where this field is displayed? are you using a custom entity to keep this history?
cause if not and your field is within the opportunity entity then you will have to loop on all your opportunities and update the field with the current value
for me the best solution is to create an entity called for example Opportunity_History and create a year field and the number of opportunities completed in that year, this way you will keep the history of the previous years when you start a new year, and you don't have to loop on all the opportunities, (the relation between those entities can be (Opportunity) N -> 1 (Opportunity_History))
Moreover you can add a condition on your plugin to check if there is a record in the Opportunity_History within this year if not then this means that this is a new year and you can create a new record, if not then you continue your count (add 1) and link this year record to the completed opportunity so you can display the count if you wich in the opportunity form
It is a custom entity however there will be no need to keep the former data it should clear on 1/1 for the next year to begin the count again excluding the following year but clearing for the contact to start counting on the new current year.
Business Applications communities