You need to sign in to do that
Don't have an account?
Invalid foreign key relationship: Task.related at
I have an issue with the email template. I wanted to put the record name(Auto number field) in to the tepmlate. This is an email triggering on task. SO I'm able to get the task fields but wanted to get the name of the record on which the task is creating.
Essentially im looking for an output in this fashion:
Task Name = ARQ 000001 Hello Lucifer a subject Pre-Meeting1 with Priority Not Started and duedate 2012-11-27 00:00:00 is been created.Please click here to open task
mail.setHTMLBody ('Task Name = ' +tsk.related.Annual_Request__r.Name +'Hello ' +theUser.Name+' '+ 'a subject '+tsk.Subject+' '+'with Priority '+tsk.status +' '+ 'and duedate ' + tsk.Activitydate +' '+'is been created.'+'<a href="https://cs3.salesforce.com/'+tsk.Id+'">Please click here to open task<a/>');
Please help me with this..
The related records who (whoid) and what (whatid) are fairly limited in what you can retrieve through the relationship due to their polymorphic nature.
Prior to Winter '13 you'd have to do a separate query on the related object to pull in additional fields like your Annual_Request__r.name. Then along came Winter '13 which allowed you to do something like this
So depending on how your "tsk" comes to be, you may be able to use that new feature or you'll have to create an additional query, possibly pull the result into a map <id,yourObject>, and get the Annual_Request__r.name value from it that way.