trigger UpdateCaseCommentFields on FeedItem (after insert, after update) {
List<Case> updates = new List<Case>();
for (FeedItem fi : Trigger.new) {
if (fi.ParentId.getSObjectType() == Case.SObjectType && fi.Visibility == 'InternalUsers') {
updates.add(new Case(
Id = fi.ParentId,
Last_Internal_Comment__c = fi.Body
));
}
else if (fi.ParentId.getSObjectType() == Case.SObjectType && fi.Visibility != 'InternalUsers') {
updates.add(new Case(
Id = fi.ParentId,
Last_External_Comment__c = fi.Body
));
}
}
update updates;
}
1 resposta
Hi
Please post this question in developer forums for a quick response, this forum is more focussed towards the declarative/configuration side of things.
developer forums:
https://developer.salesforce.com/forums/#!/feedtype=RECENT&criteria=ALLQUESTIONS
http://salesforce.stackexchange.com/
Thanks,
Bhanu P