• Steven Cambers
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
I've made a trigger to automatically create a custom object "Qualification" record attached to the Opp. I recently update this to select the relevant Qualification Record Type based on Opp Record Type.

I'm trying to push the trigger to our production environment but i haven't ever created test classes before, i'm in the process of trying to learn but this has become a rush job to push the change set live now. Anyone able to help me out? Trigger code below:

trigger CreateQualification on Opportunity (after insert, before update) {

    List<Qualification__c> qualtoinsert = new List<Qualification__c>();

    for (Opportunity opp : Trigger.new) {

        // Create qualification record only when the Stage is Updated to "Attendance"
        if (opp.StageName == 'Attendance' && !opp.Qual_trigger__c ) {
            
            if (opp.RecordTypeId == '01220000000Mebg' || opp.RecordTypeId == '0120J000000B69P' || opp.RecordTypeId == '0122000000034yA'){
                
                Qualification__c qual = new Qualification__c();
                
                qual.RecordTypeId = '0127E00000070be';
                
                qual.Opportunity__c   = opp.id;           
                opp.Qual_Trigger__c = True;
                qualtoinsert.add(qual); // For Bulk processing of the Records.
                
            } //End if
            
            else {
                
                Qualification__c qual = new Qualification__c();
                
                qual.RecordTypeId = '0127E00000070bj';
                
                qual.Opportunity__c   = opp.id;           
                opp.Qual_Trigger__c = True;
                qualtoinsert.add(qual); // For Bulk processing of the Records.
                
            } //End else          
        } //End if
    } // End of For

    // Inserting the New Qualification Record.
    if ( !qualtoinsert.isEmpty()) {
        insert qualtoinsert;
    }
}

Many Thanks,
Steve.

As the title states, i have a few exam code fields in our Salesforce instance and need to have these sent to students automatically once they are populated. The issue is we so far (constantly expanding) have 9 and not all of these are relevant to our students.

I would like to, to save myself the effort of making an individual email for each code and stop the student receiving a ton of emails, create a formula field that pulls which exam codes are populated, i can then use this field to pull the info to an auto email. I need this field therefore to be populated with the relevant exam codes but also prefix with them with the exam they are e.g.

IF(NOT(ISBLANK(A_Exam_1__c)), "A+: "&A_Exam_1__c, null)

Obviously the above works for the 1 field i was using to test this on, however, i can't think of a way to do the same check on multiple fields and pull all the information in. For Example i'd need it to check:

IF(NOT(ISBLANK(A_Exam_1__c)), "A+: "&A_Exam_1__c, null) &&
IF(NOT(ISBLANK(A_Exam_2__c)), "A+: "&A_Exam_2__c, null) etc.

Any help would be greatly apprecitated, whether possible or not.

Thanks in advance,
Steve.