TaskSubtype can be accessed in developer console, but when I tried to access it from SOQL in a task trigger, it gives me No such column 'TaskSubtype' on entity 'Task'. I do give field level security on this field. I checked Schema.DescribeFieldResult.getDescribe() on this field, it is there. Anyone know what's the issue with this field?

Or, it there any other way to determine the task is a Call or Email? Type is giving blank for Call, giving Other for Email. So I cannot depend on that.

code as below

trigger TaskTrigger on Task (after insert) {
Set<Id> parentIds = new Set<Id>();

// find out parents
for (Task t : Trigger.new){

    // determine the if the parent is case
    String tempId = t.WhatId;
    Schema.DescribeSObjectResult r = Case.sObjectType.getDescribe();
    String keyPrefix = r.getKeyPrefix();

    if ( tempId.substring(0, 3).equals(keyPrefix) ){

Map<Id, Case> caseMap = new Map<Id, Case>([Select Id, Call_1_Date__c, Call_2_Date__c, Call_3_Date__c, 
    Email_1_Date__c, Email_2_Date__c, (Select Id, Subject, TaskSubtype, CreatedDate from Tasks) from Case where Id in :parentIds]);

FLS: enter image description here

  • 2
    It would be very helpful in troubleshooting your issue if you posted your query and the code you're trying to run it with that returns the error message.
    – crmprogdev
    Aug 13, 2016 at 0:42
  • what version is the trigger/class running at?
    – cropredy
    Aug 15, 2016 at 1:00
  • @cropredy version 34
    – Jie
    Aug 15, 2016 at 17:27

3 Answers 3


Your issue is with trigger version

TaskSubType was added in Winter 16 (version 35.0). You indicate v.34.0 in your comment. The force.com UI will be at v37.0 - hence the confusion

From the release notes

The following field was added:

TaskSubtype—Provides standard subtypes to facilitate creating and searching for specific task subtypes. This field isn’t updateable.


Subtypes Added in Activity History, Events, Looked Up From Activities, Open Activity, and Tasks.

The field with api name ActivitySubtype is visible in API version 35.0 and above for the object named AcitivityHistory.

If you change the version to 35 and above, this error will get resolve.


  • It indeed got resolved.. i wish they could have more accurate error message
    – Jie
    Aug 15, 2016 at 17:40

First of all you don't need to write SOQL for fetching Task Fields inside a Task Trigger. But even you need to do that I have written a very basic task trigger like -

trigger TaskTrigger on Task (after insert) {
    List<Task> allTaskSubType = [SELECT ID, TaskSubtype from TASK where ID in: Trigger.New];

    for(Task aTask : allTaskSubType){
        System.Debug('Task Type: ' + aTask.TaskSubtype);

I am able to access the field as you can see the debug statement - enter image description here

Can you please check the Field Level Security and make sure the field is visible? Thanks.

  • i am aware of both of the issues you mentioned, i edited my question to include my code
    – Jie
    Aug 15, 2016 at 17:28

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.