Type resolution ambiguity with BusinessHours (Schema vs. System)

Issue #1866 resolved
Scott Wells repo owner created an issue

Just as with #1627 and #1799, the type BusinessHours can be found in both the Schema namespace as an SObject and the System namespace as a utility class. This creates the same potential ambiguity and therefore requires the same type of specialized contextual type inference as with Site (Location is a bit easier actually).

Comments (3)

  1. Scott Wells reporter

    This is a pre-release/test build that applies the same resolution logic used with Site to BusinessHours. It seems to address all known issues, properly resolving all of the following:

    List<BusinessHours> businessHoursRecords = [SELECT Id, Name FROM BusinessHours];
    List<Schema.BusinessHours> businessHoursRecords2 = [SELECT Id, Name FROM BusinessHours];
    BusinessHours bh = [SELECT Id, Name FROM BusinessHours LIMIT 1];
    Schema.BusinessHours bh2 = [SELECT Id, Name FROM BusinessHours LIMIT 1];
    BusinessHours.isWithin('foo', Datetime.now());
    System.BusinessHours.isWithin('foo', Datetime.now());
    List<BusinessHours> whichBusinessHoursAreThese;
    whichBusinessHoursAreThese = [SELECT Id FROM BusinessHours];
    List<Schema.BusinessHours> andWhichBusinessHoursAreThese;
    andWhichBusinessHoursAreThese = [SELECT Id FROM BusinessHours];

    You can install this build by downloading (but not extracting) the attached archive and using Settings/Preferences>Plugins>Install plugin from disk (under the gear drop-down menu). Please let me know if it doesn't fix the problems with this type.

  2. Scott Wells reporter

    New build that also includes a change for the other issue reported by the user that reported this one where OST generation was freezing at the end. Same install instructions. Please let me know whether either/both issue seems to be addressed or not.

  3. Log in to comment