You need to sign in to do that
Don't have an account?

Task Trigger
Hi Team,
Can any one please help me to create a trigger for below senario.
Object: Task
if Task.Support Team Request = AE Support Request
then{
if Task.created by.Pole = NA or North America then set Task.project= AE NA or Project id= xxxx
if Task.created by.Pole = China then set Task.project= AE China or Project id= xxxx1
if Task.created by.Pole = APAC then set Task.project= AE APAC or Project id= xxxx2
if Task.created by.Pole = EMEA or MEA then set Task.project= AE EMEA or Project id= xxxx3
if Task.created by.Pole = LATAM then set Task.project= AE LATAM or Project id= xxxx4
}
Thanks in Advance
Can any one please help me to create a trigger for below senario.
Object: Task
if Task.Support Team Request = AE Support Request
then{
if Task.created by.Pole = NA or North America then set Task.project= AE NA or Project id= xxxx
if Task.created by.Pole = China then set Task.project= AE China or Project id= xxxx1
if Task.created by.Pole = APAC then set Task.project= AE APAC or Project id= xxxx2
if Task.created by.Pole = EMEA or MEA then set Task.project= AE EMEA or Project id= xxxx3
if Task.created by.Pole = LATAM then set Task.project= AE LATAM or Project id= xxxx4
}
Thanks in Advance
First of all what is Support Team Request is it a custom field?beacuse if it is then you have custom field you have to access it with __c.
Thanks
Use below code. It will help.
Thanks,
Nitin Sharma
Thank you so much. Using your Login but facing error like "expecting a right parentheses, found 'by.Pole' at line 7 column 21" .Can you please help me on that.
Thanks
created by.Pole is custom field or what?
Thanks for your help.But we are facing some problems.
Trigger compilation is successfullyComplted.But result is not expected. Can you tell me one thing in my requirement is project field is a Lookup field, whenever we select Support Request Team = "AE Support Request" it will populate "AE NA" in project field. Can you please update me how we can achieve this. Please find my below trigger which we are done yesterday and correct me where we made the mistakes.
trigger TaskUpdate on Project_Task__c (before insert,before update){
list<Project__c> Tasklist=new List<Project__c>();
//set<id>taskcreatedbyids = new set<id>();
/*for(Project_Task__c t : Trigger.new){
taskcreatedbyids.add(t.createdBy.ID);
}*/
for(Project_Task__c t : Trigger.new){
if(t.TypeofRequest__c == 'AE Support Request'){
if(t.createdby.Pole__c == 'NA')
t.Project__c = 'AE NA';
else if(t.createdby.Pole__c == 'China')
t.Project__c = 'AE China';
else if(t.createdby.Pole__c == 'APAC')
t.Project__c = 'AE APAC';
else if(t.createdby.Pole__c == 'EMEA')
t.Project__c = 'AE EMEA';
else if(t.createdby.Pole__c == 'LATAM')
t.Project__c = 'AE LATAM';
}
}
update Tasklist;
}
Thanks
Use Task as an object. Because DML operation having on Task object.
I changed in your code so use below code.
Let me know if you need any help.
Thanks,
Nitin Sharma
Let say:
1.TASKRAY__Project_Task__c : Fields are
Support Request Team -> Type_of_Request__c = 'AE Support Request'
Project - > TASKRAY__Project__c = "AE NA" or "AE Global" Lookup filed to TASKRAY__Project__c
Hope you are getting my senario now.There is no relation ship betwen Task and TaskRay.
Thanks
ping me on hangout.
nitin.july19@gmail.com
Use below code hope it will help.
Thanks
Updated code according to your req.
Thanks,
Nitin Sharma