2

This describe call:

Task.ActivityDate.getDescribe().getLabel()

returns "Due Date Only" rather than "Due Date" (that is used in e.g. the Task edit page).

Is there some significance to the "Only" part of the label?

4

It seems likely we can attribute it to the linkage of Event and Task as Activities, and the fact that Event has a field called ActivityDateTime in addition to ActivityDate.

system.debug(Task.ActivityDate.getDescribe().getLabel()); // Due Date Only
system.debug(Event.ActivityDate.getDescribe().getLabel()); // Due Date Only
system.debug(Event.ActivityDateTime.getDescribe().getLabel()); //Due Date Time

Even though Task does not have an ActvityDateTime field, they probably wanted to maintain consistency across the two objects.

| improve this answer | |
  • Thanks - makes sense. I have some describe-based logic and I'm trying to decide whether to drop the "Only" part as it looks pretty weird in my UI. – Keith C Sep 5 '16 at 17:16
  • For a package? In your own org you could just change the label. I agree it's unsightly, and the code to swap out the label is probably going to be unsightly as well. :( – Adrian Larson Sep 5 '16 at 17:21
  • Yeah packaged code. I've added String fieldLabel = f == Task.ActivityDate && dfr.getLabel() == 'Due Date Only' ? 'Due Date' : dfr.getLabel();. – Keith C Sep 5 '16 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.