• LorrMc
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 23
    Replies
Hi, 

I need to write a tigger that will send a different email template based on a date field. 
I have an object called references that is a lookup to the contact, I need to send an email at 60,30 and 10 before the experation date and I cant use process builder or workflow so im REALLY stuck.
Could someone please give me a sample code for a trigger that I can tweek. 

Thank You,

Lorr
Hi, 
I am new to tirggers so I hope you can help, I need to send multiple email alerts based on a date field. 
The emails should send at 60,50,40,30 and 10 days before the Registration renewal date field. 
I can not use a workflow or process builder as the records will not be edited and the date may not be populated when the record is created.

I would be grateful if you could please advise as I am tottaly lost.

I hope this makes sense and Thank you in advance. 

Lorr
Hi,

I have built a process that should change the case owner if the contact owner is changed but only for a specified case record type, the issue is that it is changing all cases. 
Please see process below, have I missed somthing?
User-added image

User-added image

User-added image
I have used the 18 digit id as I thought that was the issue but still the same result. 

Any advice welcome.
Thank You,
Lorr
Hi, 
I have a case record type called Client Ending with a field on it called reason for ending which is a multi pick list.
I then have a Contact record type of Client Contact which also has a field called reason for ending and is also a multi pick list. 
What I need to do is copy the data from the case reason for ending to the field from the client ending case to the client contact page but only if this is blank.
I have created the following process but it is not working any advice welcom. 
User-added image
User-added image
User-added image
User-added image
User-added image
Please help!
 
Hi, 

We have a apex class and trigger that always workded fine however yesterday all stoped, the class  and trigger were both at 0% code coverage yesterday so I ran the tests and cleared the past test results but still no joy. 
This morning the Class has a code coverage of 100% but the trigger is still at 0% although the when I test this the batch is showing up in the job list as complete. 
Any advice would be welcome, also is there a way I see what data was sent in the batch or where it was sent to?

Thank you in advance. 

Lorr
Hi,

we have an Apex class and Trigger that once criteria is entered, it should send data to our external sheduling management company that provides then with a list of users that they then provide us with login details for there site. 

they have now said that are not reveiving our data, I have checked the apex class and trigger which seem to be fine and we can see the job in the qeue as complete after each test. 

I was wondering if there is a way I can see exactly what has been sent or at which point it has fallen down, I have ran tests but they dont really tell my anything. 

I am new to this so appologies if this sounds silly.

Any advice is gratley apppriciated. 
Hi,

I have been given great help on here earlier today regarding this tirgger however we have hit a wall and I cant seem to get past this error, please see code below any help appriciated. 
trigger TriggeronCarePlan on Care_Plan_Details__c (before insert, before update) {
    
    TriggerCarePlanHandler handler =  new TriggerCarePlanHandler();
    
   if(trigger.isUpdate || trigger.isInsert)
   {
       handler.UpdateActivestatus(Trigger.new);
       
              
  public void TriggerCarePlanHandler {
    
    set<id> allContactIDs = new set<id>();
    List<Care_Plan_Details__c> allrelatedCarePlans = new List<Care_Plan_Details__c>();
    List<Care_Plan_Details__c> updateRecords = new List<Care_Plan_Details__c>();
    
  public class UpdateActivestatus (List<Care_Plan_Details__c> Triggernew)
    {        
        for (Care_Plan_Details__c var : Triggernew)
        {
            allContactIDs.add(var.ContactID );
        }  
           (Care_Plan_Details__c var : Triggernew) { system.debug('care pla details'+' '+ var); // see what are all the details are being populated for contact. //allContactIDs.add(var.ContactID ); }
    
       allrelatedCarePlans = [select id, Active_Inactive__c,ContactID from Care_Plan_Details__c where ContactID in:allContactIDs ];
     
       
       for (Care_Plan_Details__c var : allrelatedCarePlans) 
           {
                   Care_Plan_Details__c record = new Care_Plan_Details__c();
                    record.Id = var.id;
                    Record.Active_Inactive__c = false;
               updateRecords.add(record);               
           }
        
        if (!updateRecords.isEmpty())
        { 
            update updateRecords;
        }
    }
}
 
Thank You
I am soooo not used to triggers so I found this one and tried to edit it to meet my needs but I am getting the error below. 

Error: Compile Error: Variable does not exist: contact__c at line 20 column 35

I have created a new object that will be a related list on the contact, what I need is that when a new record is created all previous records are marked inactive, I have a tick box Active which should only be ticked for the current record. 

Please see trigger below or if anyone can think of a better all advice is welcome. 

trigger TriggeronCarePlan on Care_Plan_Details__c (before insert, before update) {
    
    TriggerCarePlanHandler handler =  new TriggerCarePlanHandler();
    
   if(trigger.isUpdate || trigger.isInsert)
   {
       handler.UpdateActivestatus(Trigger.new);
       
   }
 public class TriggerCarePlanHandler {
    
    set<id> allContactIDs = new set<id>();
    List<Care_Plan_Details__c> allrelatedCarePlans = new List<Care_Plan_Details__c>();
    List<Care_Plan_Details__c> updateRecords = new List<Care_Plan_Details__c>();
    
  public void  UpdateActivestatus (List<Care_Plan_Details__c> Triggernew)
    {        
        for (Care_Plan_Details__c var : Triggernew)
        {
            allContactIDs.add(var.contact__c);
        }        
    
       allrelatedCarePlans = [select id, Active_Inactive__c,contact__c from Care_Plan_Details__c where contact__c in:allContactIDs ];
     
       
       for (Care_Plan_Details__c var : allrelatedCarePlans) 
           {
                   Care_Plan_Details__c record = new Care_Plan_Details__c();
                    record.Id = var.id;
                    Record.Active_Inactive__c = false;
               updateRecords.add(record);               
           }
        
        if (!updateRecords.isEmpty())
        { 
            update updateRecords;
        }
    }
}}

Thank you :-)
 
Hi friends,

I have 1 custom object (Dimensions__c) which has a lookup relationship with Account standard object (Dimensions__c is Child).

There is a chechbox on Dimension__c (Repayment_Enabled__c).

Now wehenever i create a dimension this check box is made true automatically.

What my need is that, there should be only one check box true on for a record related to account.
Even though there may be 5 dimension records which are related to 1 account but checkbox should be true for only 1 dimension record. 

I have tried this one, But struck.
As i am new to development Please help me.


trigger Primarycheck on Account (before insert,before update,after insert) {
List<Account> acct = new List<Account>();
    Set<Id> vwoid = new Set<Id>();
    List<Dimensions__c> vwo = new List<Dimensions__c>();   // my custom object
    for(Account a : trigger.new){
       if(Repayment_Enabled__c[0] == 'true'){   // this is the check box field which needs to be true for only one record related account
            Repayment_Enabled__c[1] = false;
        }
            }


How to solve this one.
Any help friends..!
        
        
    }