Skip to content

Instantly share code, notes, and snippets.

@miragedeb
Created June 17, 2015 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miragedeb/63d5046482006d226d8b to your computer and use it in GitHub Desktop.
Save miragedeb/63d5046482006d226d8b to your computer and use it in GitHub Desktop.
ProcessTerlerikEmail
global class ProcessTelerikEmail implements Messaging.InboundEmailHandler {
global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email,
Messaging.InboundEnvelope envelope) {
Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
List<Account> allAccountsToUpdate = new List<Account>();
for( Account acc: [SELECT Id, Burn_Test_runtime__c , Pass_Fail__c
FROM Account WHERE Account_Status__c = 'Client'
AND Hosted__c != 'Client-Internal'
AND DR_Server__c ='s3.emea2'])
{
if(email.plainTextBody.contains(acc.Id)) {
allAccountsToUpdate.add(
new Account(
Id= acc.Id,
Pass_Fail__c = 'Fail',
Burn_Test_runtime__c = String.valueOf(Datetime.now())
)
);
}
else {
allAccountsToUpdate.add(
new Account(
Id= acc.Id,
Pass_Fail__c = 'Pass',
Burn_Test_runtime__c = String.valueOf(Datetime.now())
)
);
}
}
System.debug('Processing for emea complete');
for( Account acc: [SELECT Id, Burn_Test_runtime__c , Pass_Fail__c
FROM Account WHERE Account_Status__c = 'Client'
AND Hosted__c != 'Client-Internal'
AND DR_Server__c !='s3.emea2'])
{
if(email.plainTextBody.contains(acc.Id)) {
allAccountsToUpdate.add(
new Account(
Id= acc.Id,
Pass_Fail__c = 'Fail',
Burn_Test_runtime__c = String.valueOf(Datetime.now())
)
);
}
else {
allAccountsToUpdate.add(
new Account(
Id= acc.Id,
Pass_Fail__c = 'Pass',
Burn_Test_runtime__c = String.valueOf(Datetime.now())
)
);
}
}
System.debug('Processing for US complete');
if(!allAccountsToUpdate.isEmpty()){
UPDATE allAccountsToUpdate;
}
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment