You need to sign in to do that
Don't have an account?
Invalid bind expression type of SOBJECT...
Please help, I am new to developing / Apex code and am trying to set up a trigger to update a picklist field (on an Activity)based on a different Object's picklist entry (User) - the ultimate aim is to set colours in a dashboard the same in two different objects - Activities and Opportunities...
I am getting the following error:
Error: Compile Error: Invalid bind expression type of SOBJECT:User for column of type String at line 3 column 92
And honestly I have no clue what I need to do to fix this...!
Here is my first attempt:
trigger UpdateDepartmentPicklist on Task (before update){
for(Task tsk : Trigger.new){
List<User> listUse = [Select Department_picklist__c from User where Owner_ID__c =: tsk.CreatedBy]; for
(User use : listUse){
Tsk.Owner_Department_Picklist__c = Use.Department_picklist__c;
}
update listUse;
}
}
Many thanks for any assistance or tips!
Cheers,
Kelly
Kellee,
Just add .Id to the CreatedBy:
List<User> listUse = [Select Department_picklist__c from User where Owner_ID__c =: tsk.CreatedBy.Id];
Best,
Ram
All Answers
Kellee,
Just add .Id to the CreatedBy:
List<User> listUse = [Select Department_picklist__c from User where Owner_ID__c =: tsk.CreatedBy.Id];
Best,
Ram
Much appreciated
Best,
Ram
trigger SendingMailToRecordOwner2 on Fan__c (after delete) {
list<Fan__c> a = [select id,CreatedBy.id from Fan__c where id in:trigger.old];
user u = [select id,email from user where email =: a.CreatedBy.Id];
messaging.SingleEmailMessage email = new messaging.SingleEmailMessage();
list<String> toaddress = new list<String>{'u.Email'};
email.setToAddresses(toaddress);
email.setSubject('Records deletion alert');
email.setSubject('Account records are deleted which is created by you');
messaging.Email[] emails = new messaging.Email[]{email};
messaging.sendEmail(emails);
}
Can u pls solve it....
Thanks,
kotesh.