• 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
  • April 25, 2019
  • Like
  • 0
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
  • April 24, 2019
  • Like
  • 0
Hi, 
I have built a form in FormAssembly that needs to go to all contacts, it is compiled of questions that related to fields in a custom object called References which has a lookup relationship to the contact.
I have tried a link to the form via the Salesforce Mass Email and also via Campaign Monitor however although it sends and the form opens when a contact clicks submit the following error is generated. 
1. Update - Lookup returned no record and aborted connectore execution.

I have added the record Id to the link but I can not get this to work, is this possible or is there another way to send the form and have the responses feed back to SF custom record?

Thank You, 

Lorr
  • February 07, 2019
  • Like
  • 0
Hi, 

I have this process which I have used in the past to populate the most recent related record however now I am trying to use it in reverse in the hope I can populate the earliest related record based on start date and that has a tick box of true. 
This looks at a junction object "CPR" that has two contact record types one for "client" and one for "Carer" what I need to do is tick a box on the "CPR" record but only if the tick box "First Scotland Placement" field is true and on the record with the earliest start date but only for the "Carer" record. 

I hope this makes sense and you can please help me as I am no good with triggers and trying to avoid this approch, do I need a flow? 

User-added image

User-added image

User-added image

User-added image

Thank you in advance,

Lorrr

 
  • February 05, 2019
  • Like
  • 0
Hi,

I have just moved one of my teams to lightning for the first time and we have noticed that when they go to log a task on  a lead it has to be related to an account,absence or opportunity. 

I did find a link that said create a global action to bypass this but to be honest I have never created one before and althought I have tried I dont really understand how to do it. 

Also can we not have button on the lead page that creats a task?

Any advice on creating the global action would be greatly appriciated. 

Thank You,
Lorr

 
  • October 25, 2018
  • Like
  • 0
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
  • August 14, 2018
  • Like
  • 0
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,
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 multi picklist field called reason for ending. 
What I need to do is copy the data from the case reason for ending to the field on the client contact page but only if this is blank.

I have got the following process but it is not working do I need a flow?

Thank you in advance. 

Lorr

User-added image
User-added image
User-added image
case



User-added image

Please Help!

 
Hi,

I have a check box on a related list that I have populated as true for historical data however I a rule,code or somthing to say if any previous related records have this check box as true then it can not be populated on the new record. 
Is this possible and if so how?

Thank you in advance.
Lorr
I have been around the houses with this one but not really getting anywhere. 
I have a junction object Carer_Placement__c which has a lookup to the client contact and a lookup to the carer contact.
each Carer_Placement__c has a formula field Scotland_Client__c which indicates if a Scotland Client Yes/No. 
What I need to do is look at all Carer_Placement__c related to the Carer Contact and mark Carer_Placement__c which has the earlies Start_Date__c with Scotland_Client__c = Yes
I have created a tick box field on the Carer_Placement__c called First_Scotland_Placement__c which I hope to populate as true if the criteria above is correct. 
I have tried process Builder and Flows but it is just marking everything as true, please help I am really not good with flows or process builder so Do I need code to do this? 
Thank You in advance. 
User-added image
User-added image
User-added image
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
  • April 17, 2018
  • Like
  • 0
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. 
  • April 16, 2018
  • Like
  • 0
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
  • April 05, 2018
  • Like
  • 0
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 :-)
 
  • April 05, 2018
  • Like
  • 0
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
  • April 25, 2019
  • Like
  • 0
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
  • April 24, 2019
  • Like
  • 0
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
  • August 14, 2018
  • Like
  • 0
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
  • April 17, 2018
  • Like
  • 0
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. 
  • April 16, 2018
  • Like
  • 0
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
  • April 05, 2018
  • Like
  • 0
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 :-)
 
  • April 05, 2018
  • Like
  • 0
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..!
        
        
    }