Here is my Trigger

trigger DailyTaskTrackersTrigger on Daily_Task_Tracker__c (before insert, before update,after insert,after update){

    if(Trigger.isInsert && Trigger.isUpdate && Trigger.isBefore){
        BusinessHours stdBusinessHours = [select id from businesshours where isDefault = true];
        for(Daily_Task_Tracker__c workObj: Trigger.new){
            if((workObj.Work_Start_Time__c != NULL) && (stdBusinessHours != NULL)){
                workObj.Target_Date_Time__c = BusinessHours.add(stdBusinessHours.Id,workObj.Work_Start_Time__c,long.valueOf(String.valueOf(workObj.Estimate_Time_To_Complete_Hrs__c  * 60 * 60 * 1000)));

    if(Trigger.isUpdate && Trigger.isAfter){
        list<User_Daily_Task_Tracker__c>UserDailyTaskTrc = new list<User_Daily_Task_Tracker__c>();
        for(Daily_Task_Tracker__c workObj:[SElECT ID,Name,(SELECT Name From User_Daily_Task_Tracker__r) FROM Daily_Task_Tracker__c WHERE ID IN: Trigger.new]){
            for(User_Daily_Task_Tracker__c uds: workObj.User_Daily_Task_Tracker__r){
                uds.name = workObj.Name;

        update uds1;

Error: Compile Error: Didn't understand relationship 'User_Daily_Task_Tracker__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 25 column 44


1 Answer 1


I tend to run the following in Execute Anonymous to verify the verbatim relationship name to use in SOQL:

for(ChildRelationship relationship : SObjectType.Daily_Task_Tracker__c.getChildRelationships())
    if (relationship.getChildSObject == User_Daily_Task_Tracker__c.sObjectType)

Whatever the above output, use verbatim in your subquery. If it yields Unicorns__r, use:

(SELECT Id FROM Unicorns__r)

More likely it will yield User_Daily_Task_Trackers__r. If so, use:

(SELECT Id FROM User_Daily_Task_Tracker__c)

Usually it should be plural.

You must log in to answer this question.

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