You need to sign in to do that
Don't have an account?
Deepika G P
trigger should run for only one object
I have an Custom Object 'Customer participation' and Task is created for this object, now when I send an email from the related list with the subject as executive ,a field on task object should be inserted with an value. I have created a trigger but the trigger is working on all the objects. but i want it to work only on the emails of 'Customer participation'. Could anyone help me on this please.I am begineer in salesforce.
trigger updatetaskoriginfield on Task (before insert, before update)
{
if(trigger.isBefore)
{
for(Task tsk: trigger.new)
{
String test=tsk.subject;
set<string> a=new Set<string>{'executive','Executive'};
set<string> b=new Set<string>{'award','Award'};
List<String> lsttest=test.split(' ');
for(String s: lsttest)
{
if(a.contains(s))
{
tsk.Task_Origin__c='Executive Summary';
}
else if(b.contains(s))
{
tsk.Task_Origin__c='Award Notification';
}
}
}
}
}
trigger updatetaskoriginfield on Task (before insert, before update)
{
if(trigger.isBefore)
{
for(Task tsk: trigger.new)
{
String test=tsk.subject;
set<string> a=new Set<string>{'executive','Executive'};
set<string> b=new Set<string>{'award','Award'};
List<String> lsttest=test.split(' ');
for(String s: lsttest)
{
if(a.contains(s))
{
tsk.Task_Origin__c='Executive Summary';
}
else if(b.contains(s))
{
tsk.Task_Origin__c='Award Notification';
}
}
}
}
}
1) https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BaTcIAK
All Answers
1) https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BaTcIAK
I have converted whatid to String using below code, I am able to save but trigger is not working.
String strWhatId = tsk.whatId;
if(strWhatId.startsWith('[a0v]'))
String strWhatId = tsk.whatId;
if(strWhatId.startsWith('a0v'))