You need to sign in to do that
Don't have an account?
Sittam
trigger on task
hey guys,
since it is still not possible to trigger a workflow from email to task in salesforce, im trying to solve that with an apex trigger. im trying to change the custom field(newTask.Ergebnis_Aktivit_t__c) to my chosen value, if the subject starts with "E-Mail"
Im pretty new to apex and this created from what i found on the internet.
trigger emailergebnis on Task (before Insert) {
/*Iterate over the newly created Tasks one by one*/
for(Task newTask : trigger.new){
/*Check if the Task is being created as result of Email to Task*/
if(
!String.isBlank(newTask.Subject) &&
newTask
.Subject
.toLowerCase()
.startsWith('E-Mail:')
){
newTask.Ergebnis_Aktivit_t__c = 'Email / SMS / Whatsapp';
}
}
}
since it is still not possible to trigger a workflow from email to task in salesforce, im trying to solve that with an apex trigger. im trying to change the custom field(newTask.Ergebnis_Aktivit_t__c) to my chosen value, if the subject starts with "E-Mail"
Im pretty new to apex and this created from what i found on the internet.
trigger emailergebnis on Task (before Insert) {
/*Iterate over the newly created Tasks one by one*/
for(Task newTask : trigger.new){
/*Check if the Task is being created as result of Email to Task*/
if(
!String.isBlank(newTask.Subject) &&
newTask
.Subject
.toLowerCase()
.startsWith('E-Mail:')
){
newTask.Ergebnis_Aktivit_t__c = 'Email / SMS / Whatsapp';
}
}
}
Looks like its salesforce issues .. i tested your code couple of instances .. Once instance it is not working but other instance it working as expected