• Mark Troupe
  • NEWBIE
  • 45 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 8
    Replies
I would like to write a trigger when task is completed and the case (a field) associated to the task send an email, trigger doesnt work when i add a field from a different object different from task:

.customer_Service_Agent__c is on case not task

trigger Notify_task_creator on task (after update) {
task t=[select CreatedBy.email, id, CreatedByid, CreatedBy.name, LastModifiedByid, LastModifiedBy.name, Subject
        from task 
        where id=:trigger.newMap.keySet()];

                        
for (task o : Trigger.new) 
{ 
if((o.Status=='Completed' ) && (o.CreatedByid != o.LastModifiedByid) && (o.CreatedByid != o.customer_Service_Agent__c)){ 

 MailerUtils.sendMail('<html><body>Hi ' + t.CreatedBy.name +', <br><br>' + t.LastModifiedBy.name + ' has completed the task: "' + t.Subject + '" <br><br>Click on this link for more information:</body></html>' + '\n' + 'https://p2-1147--Full.cs11.cloudforce.com/'+o.Id);
    }

} 
}


Anyone know what happened to site.com? It now just redirects you to the app cloud landing page. cheers
Hi Folks,

I want to get failure job record Id's when the batch fails can any one  tell that ?
 Please help in writting apex trigger that will pre populate the task subject as the account name when hititng the new task button.

When I hit the New Task button, the Account name must be  in the Subject. We want it to be there when we hit new, not after we save.
 

We are facing issue while fetching the Training Event fields by using following query:

Select Id,Name,Training_Offering_Id__r.Delivery_Type__c,PEPE_Training_Request__c.Training_Offering_Id__r.Theater_Region__c,PEPE_Training_Request__c.Training_Offering_Id__r.Learning_Partner__c,Local_Contact_Number__c,Training_Location_City__c,ZIP_Code__c,Geography__c,PEPE_Training_Request__c.Training_Offering_Id__r.Technology__c,PEPE_Training_Request__c.Training_Offering_Id__r.Delivery_Team__c,Learning_Partner_Name__c,PEPE_Training_Request__c.Training_Offering_Id__r.Audience__c,Fiscal_Quarter__c,Language__c,PEPE_Training_Request__c.Training_Offering_Id__r.Program__c,CSAT_Score__c,Training_Offering_Id__c,PEPE_Training_Request__c.Training_Offering_Id__r.Name,Actual_Costs__c,PEPE_Training_Request__c.Training_Offering_Id__r.Platform__c from PEPE_Training_Request__c where (Status__c='Event Approved') and (Platform__c='Partner Plus') and (CVENT_Flag__c='Yes') and (CVENT_Status__c='Not Started')

We are able to run this query on SFDC developer console. However if we pass the same query from API we are getting the blank values for fields where we are using syntax like ‘PEPE_Training_Request__c.Training_Offering_Id__r.Theater_Region__c’.

Can you please look into it?

Dear all,

I am Struggling to find how to search the end of an email in my Apex Class.
I wrote this but it doesn't work somebody helps me?

//error message if non amcor email in Contact list
            Integer i = con.email.length();
            if (con.email.substring(con.email,i - 10,10) != '@amcor.com'){ 
                isDisabled = true;
                apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.ERROR, 'You cannot send an email to this person. Email is external from Amcor domain');
                apexpages.addmessage(msg);
                System.debug('@@DEBUG non amcor email: '+con);
                return null;
            }

The error message I got is as follow :

Error: Event_Ext Compile Error: Method does not exist or incorrect signature: [String].substring(String, Integer, Integer)

Many thanks
I would like to write a trigger when task is completed and the case (a field) associated to the task send an email, trigger doesnt work when i add a field from a different object different from task:

.customer_Service_Agent__c is on case not task

trigger Notify_task_creator on task (after update) {
task t=[select CreatedBy.email, id, CreatedByid, CreatedBy.name, LastModifiedByid, LastModifiedBy.name, Subject
        from task 
        where id=:trigger.newMap.keySet()];

                        
for (task o : Trigger.new) 
{ 
if((o.Status=='Completed' ) && (o.CreatedByid != o.LastModifiedByid) && (o.CreatedByid != o.customer_Service_Agent__c)){ 

 MailerUtils.sendMail('<html><body>Hi ' + t.CreatedBy.name +', <br><br>' + t.LastModifiedBy.name + ' has completed the task: "' + t.Subject + '" <br><br>Click on this link for more information:</body></html>' + '\n' + 'https://p2-1147--Full.cs11.cloudforce.com/'+o.Id);
    }

} 
}


For a Case record, if a specified profile user edits the record and save. The user name should populate on  Case field. But whenm i add the condition it was empty. Where it is wrong ?

trigger UpdateCase on Case(before insert,before update) {

set<id> cset = new set<id>();
//Id profileUser = UserInfo.getProfileId();
//profile p = [select id,name from profile where name = 'Operations'];
for(case c:Trigger.new){
cset.add(c.id);
}

List<Case> CaseList = [select id,Assigned_To__c from case where id in:cset];

List<User> UserList = [select id,profile.id,Lastname,name from User];

for(Case Cs:Trigger.new){
for(User u :UserList ){
if(U.Profile.id == '0098467tXEr6767'){
Cs.Assigned_To__c = U.id;
Cs.UserName__c = U.id;
System.Debug('User>>>>'+U.id);
System.Debug('NameUser>>>>'+Cs.UserName__c);
}
}
}
}
  • September 22, 2014
  • Like
  • 0