You need to sign in to do that
Don't have an account?
Srini
After update the opportunity field task should be create
Hi Team,
We have fields in the opportunity called as MIDescription Whenever we entered in the description field it should create a new brand task in the Open Activities related list. For that we have created one trigger in opportunity as mentioned below. Trigger is working as expected.
But hear one problem after creating the task.We need to assign that particular task to one of the Group member. After completion the task, completion mail should be getting opportunity Manager like.
Hello XXX,
Your Task has been Completed.
Here are the details -
Subject : Test
Status: Completed
Priority : Low
Can any one please help us
Please find the Below Trigger Code:
We have fields in the opportunity called as MIDescription Whenever we entered in the description field it should create a new brand task in the Open Activities related list. For that we have created one trigger in opportunity as mentioned below. Trigger is working as expected.
But hear one problem after creating the task.We need to assign that particular task to one of the Group member. After completion the task, completion mail should be getting opportunity Manager like.
Hello XXX,
Your Task has been Completed.
Here are the details -
Subject : Test
Status: Completed
Priority : Low
Can any one please help us
Please find the Below Trigger Code:
Trigger Task on Opportunity(before insert,before Update){
Set<Id> opIds = new Set<Id>();
List<Task> taskList = new List<Task>();
List<Opportunity> Opps = Trigger.new;
List<Opportunity> taskOps = [Select Id,Description__c from Opportunity where Id in :opIds];
if(Trigger.isInsert){
for (Opportunity Opp: Opps){
Task t = new Task();
t.WhatId = opp.Id;
// t.Subject = 'Task';
t.Subject = opp.Description__c;
taskList.add(t);
}
}
if(Trigger.isUpdate){
Map<Id,Opportunity> oldOppMap = Trigger.oldmap;
for (Opportunity Opp: Opps){
if(Opp.Description__c != oldOppMap.get(opp.Id).Description__c ){
Task t = new Task();
t.WhatId = opp.Id;
// t.Subject = ' Task';
t.Subject = opp.Description__c;
taskList.add(t);
}
}
}
insert taskList;
}
Thanks in Advance
Set<Id> opIds = new Set<Id>();
List<Task> taskList = new List<Task>();
List<Opportunity> Opps = Trigger.new;
List<Opportunity> taskOps = [Select Id,Description__c from Opportunity where Id in :opIds];
if(Trigger.isInsert){
for (Opportunity Opp: Opps){
Task t = new Task();
t.WhatId = opp.Id;
// t.Subject = 'Task';
t.Subject = opp.Description__c;
taskList.add(t);
}
}
if(Trigger.isUpdate){
Map<Id,Opportunity> oldOppMap = Trigger.oldmap;
for (Opportunity Opp: Opps){
if(Opp.Description__c != oldOppMap.get(opp.Id).Description__c ){
Task t = new Task();
t.WhatId = opp.Id;
// t.Subject = ' Task';
t.Subject = opp.Description__c;
taskList.add(t);
}
}
}
insert taskList;
}
Thanks in Advance
To send the email in required format, you can configure the corresponsing email template.
Thanks for your suggestions.Can you please provide the steps how to create the workflow on task.Because am the new guy for this.
We have some question in creating workflow:
1.We have taken the Task object.
2.In evaluation criteria we have selected "created, and any time it's edited to subsequently meet criteria".
3.In the Rule criteria which one we need to select.
A).If we select formula evalution true can you please provide me the logic hear
B).If we use Criteria met please provide me the logic hear
Which one is we need to considered based on my above question.
And also please help us to create email template also
Thanks
Is there any possible to add the logic using above trigger?
Please let us know .That shoud help us.
Thanks
Please refer the below link for reference code :
http://www.sfdc99.com/2014/03/01/sending-emails-using-apex/
Please mark my answer as best answer if it helped you.