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?

1 Answer 1

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.

3
  • 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
    Commented Sep 5, 2016 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
    Commented Sep 5, 2016 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
    Commented Sep 5, 2016 at 17:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .