Paste The Last Thing You Copied

Nerevar

Sonata Dusk
Staff member
Aug 27, 2005
10,639
179
63
Equestria
#3
[QUOTE="Lefein, post: 0]Eventually, the third parties will have to compete with each other for sales over each others franchises. Sandbagging graphics won't be for too long, especially if XBone unit sales start lagging behind PS4 significantly.[/QUOTE]

I quoted him from another topic. Sorry it's not something more interesting.
 

Ixion

Ultimate Veteran
Nov 29, 2005
20,455
209
0
29
New York
#12
trigger trgr_CreateChatterGroupAlerts on Opportunity (after Update) {
try{
List<Opportunity> updatedOpptyList =
[
SELECT
Id,
Name,
Account.Name,
StageName,
LastModifiedBy.Name
FROM
Opportunity
WHERE
Id IN :trigger.newMap.keyset()
];

String chatterGroupName;

if(Test.isRunningTest()){
chatterGroupName = 'Test Chatter Group';
}
else{
chatterGroupName = 'Opportunity Stage Changes';
}

CollaborationGroup chatterGroup =
[
SELECT
Id
FROM
CollaborationGroup
WHERE
Name = :chatterGroupName
LIMIT 1
];

String changedOpptyList = '';

for(Opportunity oppty : updatedOpptyList){
if(oppty.StageName != trigger.oldMap.get(oppty.Id).StageName){
changedOpptyList +=
'Opportunity: ' + oppty.Name + ' belonging to the Account: ' + oppty.Account.Name +
' has its Stage changed from - ' + trigger.oldMap.get(oppty.Id).StageName + ' to ' +
oppty.StageName + '\r\n';
}
}

if(changedOpptyList!='' && chatterGroup!=NULL){
FeedItem feedItem = new FeedItem();

feedItem.ParentId = chatterGroup.Id;
feedItem.Body = changedOpptyList;

INSERT feedItem;
}
}
catch(Exception ex){
System.debug(
'<<<<<ERROR>>>>> Trigger: trgr_CreateChatterGroupAlerts; SObject: Opportunity; Error: ' +
ex.getMessage()
);
}
}