• Gwirizanani Sinoia
  • NEWBIE
  • 60 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 34
    Replies
I have a code snipet below works perfectly when i have one order item.  However I am looking for away to Concatenate multiple order item url/ids onto tasks comements/description field. 
ie if more than one order item description/comments = 
 https://developer.salesforce.com/ID1
https://developer.salesforce.com/ID2
https://developer.salesforce.com/ID3 etc

public class OrderProduct {
     public static void createOrderProduct (List<OrderItem> newList, Map<Id,OrderItem> oldMap){
      
    Wide__c vars = Wide__c.getOrgDefaults();  
    Set<Id > orderIds = new Set<Id>();
    List<Order > orderRecords = new List<Order >();
    set<Id > orderItemsIds = new set<Id>();
    Map<Id,OrderItem> orderItemMap = new Map<Id,OrderItem>();
    Map<String,OrderItem> orderItemCountryMap = new Map<String,OrderItem>();  
    Map<Id,String> orderItemCountryIdMap = new Map<Id,String>(); 
    Map<Id,String> oppOrderTaskMap = new Map<Id,String>();     
         
         
    List<Task > taskList = new List<Task>(); 
         List<Group> Groupid = [select Id,Name  from Group where name ='Supplier Company and WBS To Do Queue'];
     
    // get all order ids 
      
    
      for(OrderItem ord: newList){
          orderIds.add(ord.OrderId);
           }// end of for loop
     
        string ordIdField;
        system.debug('order ids' + orderIds.size()); 
      List<Order> orderRecordsList = [SELECT Id FROM Order WHERE Id in: orderIds];
      for(Order ord:orderRecordsList ){
          
          
          for(OrderItem ori: newList ){
              if(ori.cont__c!=ori.podIso__c && ori.OrderId == ord.Id && ori.OrderId != Null && 
                 ori.cont__c!=Null && ori.OrderId!=Null  ){ 
                 orderItemCountryMap.put(ori.OrderProductCountryIso__c, ori);
                 orderItemMap.put(ori.Id, ori);
              
              
              }
              
              system.debug('order item values' + orderItemCountryMap.values());
              
          }// frist loop
      }// end of last loop
      
       
         for(OrderItem ordi : orderItemCountryMap.values()){
            
             Task taskRecord = new Task() ; 
             taskRecord.Subject    = ordi.OrdName__c ; //+' '+vars.Profile_Ids__c + ordi.OrderOpportunityID__c
             if(Groupid!=null){
                  taskRecord.OwnerID = Groupid[0].id;
             }
            
             taskRecord.Priority   = 'High';
            // taskRecord.Description    = 'Comment' + ordi.Id ;
             //taskRecord.Description    = vars.Profile_Ids__c + orderItemMap.get(ordi.Id).Id ;
             taskRecord.WhatID     = ordi.OrderId;
             taskRecord.Task_Country__c=ordi.podIso__c;
             taskRecord.Type ='Order';
             taskRecord.ActivityDate = date.today() + 2;
             taskRecord.OpportunityId__c = ordi.OrderOpportunityID__c ;
             
             
             
            If(ordi.OrderCountryCode__c == orderItemMap.get(ordi.Id).OrderCountryCode__c ){
              // taskRecord.Description += '\n' + vars.Profile_Ids__c + orderItemMap.get(ordi.Id).Id; 
               if(String.isBlank(taskRecord.Description)){
                    taskRecord.Description = vars.Profile_Ids__c + orderItemMap.get(ordi.Id).Id;
                }else{
                    taskRecord.Description += '\n' + vars.Profile_Ids__c + orderItemMap.get(ordi.Id).Id; 
                }
               
             } 
             
           taskList.add(taskRecord);
            
         } 
         
         // loop through tasks update taskRecord.Description with multiple urls
        insert taskList;
    }    


}
Components are :
Object A has a one to many realtionship with B and C
Object B
Object C
CustomSeting records

Scenario
As a user I need the ability to select Save button which will do the following validations before committing to the data base
  • Check if Object A fields listed in CustomSeting records are blank
  • Check if Object B fields listed in CustomSeting records are blank
  • Check if Object C fields listed in CustomSeting records are blank
If so a popup should appear to allow the user to add required values on those blank fields. 

Happy to know your thoughts.
Thanks in Advance
 
Hi all,
I was wondering if someone cloud help me figure this out. 
I have a custom object called "OrganisationRoleName__c"
With the following text field called "RoleName__c" 
Checkbox called ''Istrue__c"
I have a Static List of words ie 
  • Hamptom
  • Avenue
  • Road 
  • Community 
On the "OrganisationRoleName__c" object I have records with the following values:
  • New Hamport Place
  • People Avenue
  • Gregory Road
  • Developer Community
Scenario
If a record is created and RoleName__c name substring is contained in the Static List set strue__c= true.

Hope this makes sense.
Thanks in advance.




 
Hi,

Could some help with a solution to assign users multiple with Permissionsets based on the license of their profile and type of profile

Thanks in advance 
Chatter Post in Flow Builder
Hi,

I have succesfully built a flow which does the following:

-Creates a Work.com Thanks record
-Creates a Work.com Badge Record
-Creates a chatter post, which includes the congratulations message and badge notification.Screenshot below

My issue is that to create the Chatter post, I am using a create record function but when the message displays on chatter the mention @ part doesnt work. It just displays the Opportunity Owner ID rather than @mentioning them.

I am calling the Opportunity Owner ID in the flow and setting it in the variable of {!VAR_OpportunityOwnerId} which is then used in the message.

I am aware there is a Post to Chatter under Core Actions (which does the @mention correctly) but I can't get this to work and add the created badge to the chatter post as well.


User-added image

Any guidance would be appreciated?

 
Hi everyone,

I am currently getting 68% test coverage. Please help!

global class MatchingAddBatch Implements Schedulable, Database.Batchable<sObject>,Database.Stateful{
    Double failedUpdates;
    Id customerRecordType;
    global void execute(SchedulableContext sc) {
        Database.executeBatch(this);
    }
    
    global database.queryLocator start(Database.BatchableContext BC) { 
        customerRecordType = Schema.SObjectType.Account.RecordTypeInfosByName.get('Customer').RecordTypeId;
        
        return database.getQueryLocator([SELECT Id, Name FROM Account WHERE isPersonAccount=true AND RecordTypeId=:customerRecordType]);
    } // end of start
    
    
    
    global void execute(Database.BatchableContext BC, list<Account> scope) {
        
        failedUpdates=0;
        
        List<Account> acctInBatch = [SELECT Id,PersonMailingCity,PersonMailingStreet,PersonHomePhone, PersonMobilePhone(SELECT Id,Name,HomePhone__c, Organisation__c,addressLine2__c,addressLine1__c FROM Addresses__r
              where     sourceSystem__c!=NUll  and     sourceSystem__c!='wewe' and sourceSystem__c !='wewe'and sourceSystem__c!='eoei' and
             addressKey__c!=Null and Organisation__c != Null and Organisation__r.RecordTypeId=:customerRecordType and Organisation__r.Id != Null  )
              FROM Account
              WHERE Id IN :scope ];
        
        List <address__c> custMatch= new List <address__c>();
        Map<Id, Account> mapObj2=new Map<Id, Account>();
        
        for (Account acct : acctInBatch) {
            if (acct.Addresses__r.isEmpty()) //check if it empty
                continue;
            for (address__c a : acct.Addresses__r) {
               
                
                if(acct.PersonHomePhone!=a.HomePhone__c){
                    a.Postal_Code_No_Match__c=true;}
                else{a.Postal_Code_No_Match__c=false;}
                if(acct.PersonMailingStreet!=a.addressLine1__c){
                    a.AddressLine1NoMatch__c= true;}
                else{a.AddressLine1NoMatch__c=false;}
                if(acct.PersonMailingCity!=a.ZL_addressLine2__c){
                    a.Address_Line_2_No_Match__c= true;}
                else{a.Address_Line_2_No_Match__c=false;}
                
                
          
                custMatch.add(a);
            }// end of address__c loop
            
        }//end of Account For loop
        
       
        
        system.debug(custMatch.size());
        List<Database.SaveResult> dsrs = Database.update(custMatch, false);
        for(Database.SaveResult dsr : dsrs){
            if(!dsr.isSuccess()){
                failedUpdates++;
            }
            
        }     // end of database update loop
        
        
    } 
    
    global void finish(Database.BatchableContext BC) {
        
        AsyncApexJob a = [SELECT id, ApexClassId, 
                          JobItemsProcessed, 
                          TotalJobItems, 
                          NumberOfErrors, 
                          CreatedBy.Email 
                          FROM AsyncApexJob 
                          WHERE id = :BC.getJobId()];
        
        String emailMessage = 
            'Your batch job '
            + 'AccountCustomerMatchBathJob' 
            + ' has finished.  It executed ' 
            + a.totalJobItems +
            ' batches.  Of which, ' 
            + a.jobitemsprocessed 
            + ' processed without any exceptions' 
            + 'thrown and ' 
            + a.numberOfErrors +
            ' batches threw unhandled exceptions.'
            + '  Of the batches that executed without error' 
            + failedUpdates 
            + ' records were not updated successfully.';
        
        Messaging.SingleEmailMessage mail = 
            new Messaging.SingleEmailMessage();
        String[] toAddresses = new String[] 
        {a.createdBy.email, 'blala@yahoo.com'};
            mail.setToAddresses(toAddresses);
        mail.setReplyTo();
        mail.setSenderDisplayName('Batch Job Summary');
        mail.setSubject('Batch job completed');
        mail.setPlainTextBody(emailMessage);
        mail.setHtmlBody(emailMessage);
        Messaging.sendEmail(new 
                            Messaging.SingleEmailMessage[] { mail });
                            
                            
    @istest

public class MatchingAdd {
    
    
    static testMethod void testMatching(){
        MatchingAddBatch obj = new MatchingAddBatch();
        String RecTypeId = GlobalUitlity.getRecordTypeIdByName('Account','Customer');   
        String query = 'SELECT Id, Name FROM Account WHERE isPersonAccount=true ' +
            
            'WHERE Id NOT IN (SELECT Organisation__c FROM address__r)';
        
      
        
        List<Account> lstCustomerAccountOneMatch = new List<Account>();
        List<Contact> conList = new List<Contact>();
        List <address__c> custMatch= new List <address__c>();
        
        
        Account a = new Account(FirstName='Bla' , LastName = 'AccTwoEmailMatch', RecordTypeId = RecTypeId, PersonEmail = 'TwoMatch@mail.com', 
                                goneAway__pc=true ,PersonMailingPostalCode= 'abdewi', 
                                PersonMailingStreet = 'my house,21456', PersonMailingCity='town');
        lstCustomerAccountOneMatch.add(a); 
        system.debug(lstCustomerAccountOneMatch.size()); 
        system.debug(a.Name);
        
        insert lstCustomerAccountOneMatch;
        
        
        Contact con =new Contact( FirstName=a.FirstName, LastName=a.LastName
                                );
        conlist.add(con);   
        insert conList;
        system.debug(conList.size()); 
        system.debug(con.LastName);
        
        
        
        address__c addre = new address__c(  GoneAway__c=true, postalCode__c=a.PersonMailingPostalCode, Organisation__c=a.id, contact__c=con.id,
                                                addressLine1__c =a.PersonMailingStreet, addressLine2__c=a.PersonMailingCity
                                                
                                               );  
        custMatch.add(addre);  
        insert custMatch;           
      
         
         
       Test.startTest();
     //   obj.execute(null,[select id from account]);
      
        
        DataBase.executeBatch(obj, 200); 
        
       Test.stopTest();
    Integer listCont = [select COUNT() from address__c where Organisation__c = :a.id ];
    System.assertEquals(1, listCont); 
        
        
    }// end of test method
    
    
}// end of Class                        
                            
        
        
          
        
    } 
}
Help
Trying to get code coverage for the code below. I am currently getting 69% on this triggger. I can not seem to cover  the try cacth block. Please help
Thanks

trigger ContactTrigger on Contact (before update, after update) {
    Contacthandler = ContactHandler.getHandler();
    
    try {        
        if(Trigger.isBefore) {
            if (Trigger.isUpdate) {
                
                
                handler.checkmytest(Trigger.new);//check if dates have changed
                handler.checkpeople(Trigger.new);//sort dates according to source and priority
                
        }

        
        if(Trigger.isAfter) {
            if (Trigger.isUpdate) {
                handler.individual(Trigger.new, Trigger.oldMap);
            }
        }
    }
    catch(DMLException e) {
        for (Integer i=0 ; i<e.getNumDml() ; i++) {
            Contact o = Trigger.newMap.get(e.getDmlId(i));
            o.addError(e.getDmlMessage(i));
        }
    }
}

 
Hi All, Please help!

I have the following scenario of at least four email address field on one object called Students
  1. Email1
  2. Email2
  3. Email3
  4. Email4
All with a LastModified date that captures the date on update of that particular email address. Please note the fields are named after the parent email address.On the following fields:
  1. Email1Date
  2. Email2Date
  3. Email3Date
  4. Email4Date
Formula fields to caculate the number of days the email was modified or created from today.Please note days are name after the parent date
  1. Email1Days
  2. Email2Days
  3. Email3Days
  4. Email4Days
A primary email address field:
  1. PrimaryEmail

The objective is to create a trigger that will loop through the number of days and find the lowest and then populate the Primary email address with a corresponding address. This  lowest number of days will mean the email is current therefore populate the primary address. However  the logic  should  also be able to  take into consideration when one or more number of days fields are blank. Please note they is always one or more addresses all the time. The logic should also exempt users who manually update the Primary email address field.

Many Thanks 


 
Hi all,

I am in the process of building a trigger that  compares 6 date values on an object against each other to see which one is current. What is the most effecient way to do this? The aim is to ensure that no value is left out in the logic.

Thanks in Advance
Hi all,

i have business case where I have two objects in a masterdetail relationship. My objective is to be able to append parent record auto number field to the child record number
  ie Parent record number Pr01 and child record number 1. The main thing is the  child record number is a count of how many child records are associated with that particular parent. For Example
Lets say PR01 is related to a three child records then the child record number should be PR01.1 the next PR01.2 and so on
Thanks in advance
Hi everyone,
I have a total of five fields with data type picklist all with values low, meduim and high. I looking to update a record when at least four of the five fields have a value low or meduim. Please note the fields are on the same record.

thanks in advance
Hi everyone. I am a newbie..
My working trigger is as follows. As you can see record insertion works perfectly well. However i am trying to add update functionality to it. 
Please help?. A few lines of test class will be good too.

Thanks so much in advance


My trigger handler
public class PreAppLifeUpdateInsert {
    
    
       public static void myPreAppTable(List <Pre_Application__c> preApplication){
     

    List <PA_Pre_App_Life_Assured__c> preAppCreateList = new List <PA_Pre_App_Life_Assured__c>();

    for(Pre_Application__c preAppLoop : preApplication){
        PA_Pre_App_Life_Assured__c insertRecords;
        

       insertRecords = new PA_Pre_App_Life_Assured__c(Pre_Application__c = preAppLoop.Id); 
        // Begining of Life Prelife Table
        if(preAppLoop.Age_at_next_birthday__c>=17  && preAppLoop.Age_at_next_birthday__c<=35 && preAppLoop.PA_Life_Sum_Assured__c>= 0 && preAppLoop.PA_Life_Sum_Assured__c<=750000  ||
           preAppLoop.Age_at_next_birthday__c>=36  && preAppLoop.Age_at_next_birthday__c<=40 && preAppLoop.PA_Life_Sum_Assured__c>= 0 && preAppLoop.PA_Life_Sum_Assured__c<=600000  
          
              { insertRecords.Life_Assured__c    = 'NO NML EVIDENCE NEEDED';   } 
        
        //begining of Life NSE_c update
        if(preAppLoop.Age_at_next_birthday__c>=17 && preAppLoop.Age_at_next_birthday__c<=35 && preAppLoop.PA_Life_Sum_Assured__c>= 750001  && preAppLoop.PA_Life_Sum_Assured__c<=1000000 ||
           preAppLoop.Age_at_next_birthday__c>=36 && preAppLoop.Age_at_next_birthday__c<=40 && preAppLoop.PA_Life_Sum_Assured__c>= 600001  && preAppLoop.PA_Life_Sum_Assured__c<=1000000 
           
        { insertRecords.Life_Assured__c    = 'NSE*'; } //end of Life (NSE_c update)
        
        //begining of Life NSE_c NML_GPR__c  update
        if (preAppLoop.Age_at_next_birthday__c>=17 && preAppLoop.Age_at_next_birthday__c<=35 && preAppLoop.PA_Life_Sum_Assured__c>= 1000001  && preAppLoop.PA_Life_Sum_Assured__c<=1500000 ||
            preAppLoop.Age_at_next_birthday__c>=36 && preAppLoop.Age_at_next_birthday__c<=40 && preAppLoop.PA_Life_Sum_Assured__c>= 1000001  && preAppLoop.PA_Life_Sum_Assured__c<=1500000 
            
        { insertRecords.Life_Assured__c    = 'NSE* NML GPR';} // end of Life NSE_c NML_GPR__c  update
        
         //begining of Life NSE* NML GPR HIV~  update
         if (preAppLoop.Age_at_next_birthday__c>=17 && preAppLoop.Age_at_next_birthday__c<=35 && preAppLoop.PA_Life_Sum_Assured__c>= 1500001  && preAppLoop.PA_Life_Sum_Assured__c<=2000000 ||
             preAppLoop.Age_at_next_birthday__c>=36 && preAppLoop.Age_at_next_birthday__c<=40 && preAppLoop.PA_Life_Sum_Assured__c>= 1500001  && preAppLoop.PA_Life_Sum_Assured__c<=2000000 )
         {insertRecords.Life_Assured__c    = 'NSE* NML GPR HIV~';}//End of Life NSE* NML GPR HIV~  update
        
        //begining of Life NML GPR HIV~ FQ MER* FBP
         if (preAppLoop.Age_at_next_birthday__c>=17 && preAppLoop.Age_at_next_birthday__c<=35 && preAppLoop.PA_Life_Sum_Assured__c>= 2000001  && preAppLoop.PA_Life_Sum_Assured__c<=3500000 ||
             preAppLoop.Age_at_next_birthday__c>=36 && preAppLoop.Age_at_next_birthday__c<=40 && preAppLoop.PA_Life_Sum_Assured__c>= 2000001  && preAppLoop.PA_Life_Sum_Assured__c<=3500000 )
         {insertRecords.Life_Assured__c    = 'NML GPR HIV~ FQ MER* FBP';}//end of NML GPR HIV~ FQ MER* FBP update

          //begining of Life NML GPR HIV~ FQ MER* FBP FC  update
          if(preAppLoop.Age_at_next_birthday__c>=17 && preAppLoop.Age_at_next_birthday__c<=35 && preAppLoop.PA_Life_Sum_Assured__c>= 3500001  && preAppLoop.PA_Life_Sum_Assured__c<=7500000 ||
             preAppLoop.Age_at_next_birthday__c>=36 && preAppLoop.Age_at_next_birthday__c<=40 && preAppLoop.PA_Life_Sum_Assured__c>= 3500001  && preAppLoop.PA_Life_Sum_Assured__c<=7500000 ||
             preAppLoop.Age_at_next_birthday__c>=46 && preAppLoop.Age_at_next_birthday__c<=50 && preAppLoop.PA_Life_Sum_Assured__c>= 3500001  && preAppLoop.PA_Life_Sum_Assured__c<=4000000 )
          {insertRecords.Life_Assured__c    = 'NML GPR HIV~ FQ MER* FBP FC';} //end of NML GPR HIV~ FQ MER* FBP FC update
        
         preAppCreateList.add(insertRecords);} //End of for loop
  insert preAppCreateList;
       
       }// end of Method

}// end of class

My trigger class

trigger PreAppTrigger on Pre_Application__c ( after insert, after update) {
    PreAppLifeUpdateInsert.myPreAppTable(trigger.new);
    

}
 
I am a new developer and trying to create a trigger that creates and updates child records based on  changes to the related object.
I have two objects in a master detail relationship
Testchild_c
Testparent_c
Testparent__c has P1 amount field , P2 amount field ,P3 amount field(currency) and Age Field(number field)
Testchild_c has result output fields based on amount  and Age on Testparent__c. Testchild_c fields are = P1result, P2result, P3result(text fields)
The table matrix table has all the variables
ie if  P1__c= $100000 and Age__c=17 output to P1 result field  'MER* Full GPR FBP' and if P2_c = $800000 output to P2result= 'Full GPR, MER*, FBP, Ex ECG**, FQ'
What the trigger need to do is either create or update the record. If two conditions are met to create and update the other etc.
I have matrix table to explain wha I am trying to say.
thanks in advance

User-added image



 
Could some please help with the following error i am getting on my code

system.assertEquals([Select Id from Pl_Caseit__c Where ID =:policyList[0].Id].Id!=null,true);
Hi all,
I was wondering if someone cloud help me figure this out. 
I have a custom object called "OrganisationRoleName__c"
With the following text field called "RoleName__c" 
Checkbox called ''Istrue__c"
I have a Static List of words ie 
  • Hamptom
  • Avenue
  • Road 
  • Community 
On the "OrganisationRoleName__c" object I have records with the following values:
  • New Hamport Place
  • People Avenue
  • Gregory Road
  • Developer Community
Scenario
If a record is created and RoleName__c name substring is contained in the Static List set strue__c= true.

Hope this makes sense.
Thanks in advance.




 
Hi,

Could some help with a solution to assign users multiple with Permissionsets based on the license of their profile and type of profile

Thanks in advance 
Help
Trying to get code coverage for the code below. I am currently getting 69% on this triggger. I can not seem to cover  the try cacth block. Please help
Thanks

trigger ContactTrigger on Contact (before update, after update) {
    Contacthandler = ContactHandler.getHandler();
    
    try {        
        if(Trigger.isBefore) {
            if (Trigger.isUpdate) {
                
                
                handler.checkmytest(Trigger.new);//check if dates have changed
                handler.checkpeople(Trigger.new);//sort dates according to source and priority
                
        }

        
        if(Trigger.isAfter) {
            if (Trigger.isUpdate) {
                handler.individual(Trigger.new, Trigger.oldMap);
            }
        }
    }
    catch(DMLException e) {
        for (Integer i=0 ; i<e.getNumDml() ; i++) {
            Contact o = Trigger.newMap.get(e.getDmlId(i));
            o.addError(e.getDmlMessage(i));
        }
    }
}

 
Hi All, Please help!

I have the following scenario of at least four email address field on one object called Students
  1. Email1
  2. Email2
  3. Email3
  4. Email4
All with a LastModified date that captures the date on update of that particular email address. Please note the fields are named after the parent email address.On the following fields:
  1. Email1Date
  2. Email2Date
  3. Email3Date
  4. Email4Date
Formula fields to caculate the number of days the email was modified or created from today.Please note days are name after the parent date
  1. Email1Days
  2. Email2Days
  3. Email3Days
  4. Email4Days
A primary email address field:
  1. PrimaryEmail

The objective is to create a trigger that will loop through the number of days and find the lowest and then populate the Primary email address with a corresponding address. This  lowest number of days will mean the email is current therefore populate the primary address. However  the logic  should  also be able to  take into consideration when one or more number of days fields are blank. Please note they is always one or more addresses all the time. The logic should also exempt users who manually update the Primary email address field.

Many Thanks 


 
Hi all,

I am in the process of building a trigger that  compares 6 date values on an object against each other to see which one is current. What is the most effecient way to do this? The aim is to ensure that no value is left out in the logic.

Thanks in Advance
Hi all,

i have business case where I have two objects in a masterdetail relationship. My objective is to be able to append parent record auto number field to the child record number
  ie Parent record number Pr01 and child record number 1. The main thing is the  child record number is a count of how many child records are associated with that particular parent. For Example
Lets say PR01 is related to a three child records then the child record number should be PR01.1 the next PR01.2 and so on
Thanks in advance
Hi everyone,
I have a total of five fields with data type picklist all with values low, meduim and high. I looking to update a record when at least four of the five fields have a value low or meduim. Please note the fields are on the same record.

thanks in advance
Hi everyone. I am a newbie..
My working trigger is as follows. As you can see record insertion works perfectly well. However i am trying to add update functionality to it. 
Please help?. A few lines of test class will be good too.

Thanks so much in advance


My trigger handler
public class PreAppLifeUpdateInsert {
    
    
       public static void myPreAppTable(List <Pre_Application__c> preApplication){
     

    List <PA_Pre_App_Life_Assured__c> preAppCreateList = new List <PA_Pre_App_Life_Assured__c>();

    for(Pre_Application__c preAppLoop : preApplication){
        PA_Pre_App_Life_Assured__c insertRecords;
        

       insertRecords = new PA_Pre_App_Life_Assured__c(Pre_Application__c = preAppLoop.Id); 
        // Begining of Life Prelife Table
        if(preAppLoop.Age_at_next_birthday__c>=17  && preAppLoop.Age_at_next_birthday__c<=35 && preAppLoop.PA_Life_Sum_Assured__c>= 0 && preAppLoop.PA_Life_Sum_Assured__c<=750000  ||
           preAppLoop.Age_at_next_birthday__c>=36  && preAppLoop.Age_at_next_birthday__c<=40 && preAppLoop.PA_Life_Sum_Assured__c>= 0 && preAppLoop.PA_Life_Sum_Assured__c<=600000  
          
              { insertRecords.Life_Assured__c    = 'NO NML EVIDENCE NEEDED';   } 
        
        //begining of Life NSE_c update
        if(preAppLoop.Age_at_next_birthday__c>=17 && preAppLoop.Age_at_next_birthday__c<=35 && preAppLoop.PA_Life_Sum_Assured__c>= 750001  && preAppLoop.PA_Life_Sum_Assured__c<=1000000 ||
           preAppLoop.Age_at_next_birthday__c>=36 && preAppLoop.Age_at_next_birthday__c<=40 && preAppLoop.PA_Life_Sum_Assured__c>= 600001  && preAppLoop.PA_Life_Sum_Assured__c<=1000000 
           
        { insertRecords.Life_Assured__c    = 'NSE*'; } //end of Life (NSE_c update)
        
        //begining of Life NSE_c NML_GPR__c  update
        if (preAppLoop.Age_at_next_birthday__c>=17 && preAppLoop.Age_at_next_birthday__c<=35 && preAppLoop.PA_Life_Sum_Assured__c>= 1000001  && preAppLoop.PA_Life_Sum_Assured__c<=1500000 ||
            preAppLoop.Age_at_next_birthday__c>=36 && preAppLoop.Age_at_next_birthday__c<=40 && preAppLoop.PA_Life_Sum_Assured__c>= 1000001  && preAppLoop.PA_Life_Sum_Assured__c<=1500000 
            
        { insertRecords.Life_Assured__c    = 'NSE* NML GPR';} // end of Life NSE_c NML_GPR__c  update
        
         //begining of Life NSE* NML GPR HIV~  update
         if (preAppLoop.Age_at_next_birthday__c>=17 && preAppLoop.Age_at_next_birthday__c<=35 && preAppLoop.PA_Life_Sum_Assured__c>= 1500001  && preAppLoop.PA_Life_Sum_Assured__c<=2000000 ||
             preAppLoop.Age_at_next_birthday__c>=36 && preAppLoop.Age_at_next_birthday__c<=40 && preAppLoop.PA_Life_Sum_Assured__c>= 1500001  && preAppLoop.PA_Life_Sum_Assured__c<=2000000 )
         {insertRecords.Life_Assured__c    = 'NSE* NML GPR HIV~';}//End of Life NSE* NML GPR HIV~  update
        
        //begining of Life NML GPR HIV~ FQ MER* FBP
         if (preAppLoop.Age_at_next_birthday__c>=17 && preAppLoop.Age_at_next_birthday__c<=35 && preAppLoop.PA_Life_Sum_Assured__c>= 2000001  && preAppLoop.PA_Life_Sum_Assured__c<=3500000 ||
             preAppLoop.Age_at_next_birthday__c>=36 && preAppLoop.Age_at_next_birthday__c<=40 && preAppLoop.PA_Life_Sum_Assured__c>= 2000001  && preAppLoop.PA_Life_Sum_Assured__c<=3500000 )
         {insertRecords.Life_Assured__c    = 'NML GPR HIV~ FQ MER* FBP';}//end of NML GPR HIV~ FQ MER* FBP update

          //begining of Life NML GPR HIV~ FQ MER* FBP FC  update
          if(preAppLoop.Age_at_next_birthday__c>=17 && preAppLoop.Age_at_next_birthday__c<=35 && preAppLoop.PA_Life_Sum_Assured__c>= 3500001  && preAppLoop.PA_Life_Sum_Assured__c<=7500000 ||
             preAppLoop.Age_at_next_birthday__c>=36 && preAppLoop.Age_at_next_birthday__c<=40 && preAppLoop.PA_Life_Sum_Assured__c>= 3500001  && preAppLoop.PA_Life_Sum_Assured__c<=7500000 ||
             preAppLoop.Age_at_next_birthday__c>=46 && preAppLoop.Age_at_next_birthday__c<=50 && preAppLoop.PA_Life_Sum_Assured__c>= 3500001  && preAppLoop.PA_Life_Sum_Assured__c<=4000000 )
          {insertRecords.Life_Assured__c    = 'NML GPR HIV~ FQ MER* FBP FC';} //end of NML GPR HIV~ FQ MER* FBP FC update
        
         preAppCreateList.add(insertRecords);} //End of for loop
  insert preAppCreateList;
       
       }// end of Method

}// end of class

My trigger class

trigger PreAppTrigger on Pre_Application__c ( after insert, after update) {
    PreAppLifeUpdateInsert.myPreAppTable(trigger.new);
    

}