*** NOTE: ALL INFORMATION IS ACCURATE AT DATE OF PUBLISHING ***
Tracking activities in CRM is easy. You can link them to different entities, create them via Outlook or your phone, and make sure your time is documented. On occasion you may find the need to add an additional type of activity, a timesheet or way to document effort spent on a case or project. This is when a custom entity is needed. The best approach for an activity is to make sure you define it as an activity entity as you are creating it (more on why this is important in a moment). Tick the box, then indicate if you want this activity type displayed in activity menus as an option (probably yes!).
Once the entity is created, you will see that the following three fields are among those created automatically. The Actual Start, Actual End and Actual Duration. Make sure you add these to your new activity entity form.
Here you can see a timesheet for research has been added to a case.
This is very important to note, that on cases, the actual duration field is used to calculate the total time spent when you resolve a case.
So, keeping that in mind, if you don’t define the entity as an activity when you create it…. and then realise you want to use it to track time spent against cases…. well you are kind of out of luck. The ‘define as an activity entity’ box can only be ticked when you create the entity. It’s locked thereafter. 🙁 if you need it to be part of the time calculation on a case, you will just need to start again unfortunately.
However, if it’s not an activity related to a case, you can find a way around it. Simply create a Start Date field, an End Date field, and then a Decimal Field that is Calculated. The action is to set the Duration to the Difference in Minutes between the two date fields, then divide by 60 to give you hours as a fraction.
You can now see the calculation is a locked field and will recalculate each time you change one of the date fields and save the record. This field could then be used in a roll up field if needed to track total time spent on a parent record.
You can use this as your script. Make sure to use your specific field name in place of new_startdate.
var attr = Xrm.Page.getAttribute(“new_startdate”);
Now add it to your Form Properties. Next time a user creates a new activity record, the date and time will be populate in to the start date field.
Any other reasons you can think of to make sure you tick the box to create an activity entity? Let me know in the comments below!
Check out the latest post:
Internal Notification Emails For Event Forms In Realtime Marketing
This is just 1 of 440 articles. You can browse through all of them by going to the main blog page, or navigate through different categories to find more content you are interested in. You can also subscribe and get new blog posts emailed to you directly.