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

when a new high priority case is created on an account with reason as Breakdown the case information has to be posted on to the chatter box using triggers
The above is the scenario
I want an answer for this
I want an answer for this
Can you check the below trigger which will add body as subject of the case.
Can you confirm if we need to check reason on Account or Case?
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
All Answers
What information you need to post in chatter. You need information related to specific fields?
Thanks,
May be, it will help you.
trigger casetrigger on Case (after insert) {
if(Trigger.isAfter && Trigger.isInsert){
list<FeedItem> lstFI = new list<FeedItem>();
for(Case cc : Trigger.new){
FeedItem post = new FeedItem();
post.ParentId = cc.Id;
post.Body = 'BreakDown the case information';
lstFI.add(post);
}
Insert lstFI;
}
}
If it helps,mark as best answer
trigger casetrigger on Case (after insert) {
if(Trigger.isAfter && Trigger.isInsert){
list<FeedItem> lstFI = new list<FeedItem>();
for(Case cc : Trigger.new){
if(cc.Priority == 'High'){
FeedItem post = new FeedItem();
post.ParentId = cc.Id;
post.Body = 'BreakDown the case information';
lstFI.add(post);
}
}
Insert lstFI;
}
}
Whenever case is created & priority is high, then only it will fire the trigger.
Can you check the below trigger which will add body as subject of the case.
Can you confirm if we need to check reason on Account or Case?
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
if(cc.Priority == 'High' && cc.Reason == 'Breakdown')
Pls,add case reason also,i forgot about case reason. I am sorry about this one.Now,it works your conditions are met, not every time.
Pls, mark it as best answer.
Your codes has worked out to me but there are three conditions here if(Cc.Priority=='High'&&Cc.Status=='New'&& cc.Reason=='BreakDown' if(Cc.Priority=='High'&&Cc.Status=='New'&& cc.Reason=='BreakDown')