You need to sign in to do that
Don't have an account?
MattMet86
Trigger - If What.Type.equals()
Need a little help. I can't figure out the correct syntax to utilize Task What.Type in my trigger. Can someone tell me what I am doing wrong?
trigger ININRelatedToFix on Task (after Insert, after Update) { //Get Record Type RecordType Five9Rec = [select id from RecordType where name = 'Five9 Call' AND sobjecttype = 'Task' limit 1]; system.debug('RecordType= '+Five9Rec.Id); //Create List for bulkified update List<Task> taskList = new List<Task>(); //Loop through each task handed to trigger for (Task T : Trigger.new) { //If Call is related to Employee Session instead of Employee //******************* If(T.What.Type.equals('Employee_Session__c') && T.RecordTypeId == Five9Rec.Id){ //Get the employee Employee_Session__c Emp = [Select Employee__c FROM Employee_Session__c WHERE ID = :T.WhatId]; //Fix Relationship T.WhatId = Emp.Employee__c; taskList.add(t); } } //Builify Update update tasklist; }
All Answers
if(t.WhoId!=null && t.Who.type== 'Lead')