Issue with OST for Knowledge__DataCategorySelection

Issue #2469 resolved
Jason Clark created an issue

When working with Knowledge__DataCategorySelection, I’m getting type-checking errors on DataCategoryName and DataCategoryGroupName fields. In the OST (and the linked documentation, to be fair), the data type of these two fields is DATACATEGORYGROUPREFERENCE. However, within Apex they are just Strings. As far as I can tell, there is no additional functionality implied by the type DATACATEGORYGROUPREFERENCE (for example, getting the label vs. developer name); they are just strings in Apex, but without casting them, I get type-checking warnings. OTOH, I don’t need to cast them to save/compile to the org.

I’m not sure what makes sense here; clearly SF reports this as another Datatype, but that Datatype doesn’t seem to exist in Apex. I can cast to String to remove the warnings; but that seems unnecessary since the fields are clearing behaving as Strings.

Here’s the OST entry for the object. When viewing in WebStorm, all of the Datatypes are highlighted, and hovering a data type provides pop-over help on the datatype, EXCEPT for DATACATEGORYGROUPREFERENCE; that appears in white text as though it isn’t a real datatype.

// Generated by Illuminated Cloud on Mon Nov 27 10:34:02 EST 2023. Do not edit.

global class /*Schema.*/Knowledge__DataCategorySelection extends SObject 
{
    global User CreatedBy;
    global Id CreatedById;
    global Datetime CreatedDate;
    global DATACATEGORYGROUPREFERENCE DataCategoryGroupName;
    global DATACATEGORYGROUPREFERENCE DataCategoryName;
    global static final SObjectTypeFields fields;
    global Boolean IsDeleted;
    global Knowledge__kav Parent;
    global Id ParentId;
    global static final SObjectType SObjectType;
    global Datetime SystemModstamp;
    global UserRecordAccess UserRecordAccess;

    global Knowledge__DataCategorySelection()
    {
    }
}

And here is an example of working code with a type-checking warning. Note that the linked declaration for DATACATEGORYGROUPREFERENCE doesn’t actually open any documentation.

Comments (4)

  1. Scott Wells repo owner

    Thanks for reporting. Fix committed for the next released build (right now tracking for early next week). Here's the OST entry for that type now:

    global class /*Schema.*/Knowledge__DataCategorySelection extends SObject 
    {
        global User CreatedBy;
        global Id CreatedById;
        global Datetime CreatedDate;
        global String DataCategoryGroupName;
        global String DataCategoryName;
        global static final SObjectTypeFields fields;
        global Boolean IsDeleted;
        global Knowledge__kav Parent;
        global Id ParentId;
        global static final SObjectType SObjectType;
        global Datetime SystemModstamp;
        global UserRecordAccess UserRecordAccess;
    
        global Knowledge__DataCategorySelection()
        {
        }
    }
    

    The TypeScript definition has been similarly fixed:

    declare interface Knowledge__DataCategorySelection extends SObject 
    {
        CreatedBy: User;
        CreatedById: string;
        CreatedDate: Date;
        DataCategoryGroupName: string;
        DataCategoryName: string;
        IsDeleted: boolean;
        Parent: Knowledge__kav;
        ParentId: string;
        SystemModstamp: Date;
    }
    

  2. Log in to comment