• Pallavi Desireddy
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 0
    Replies
Am trying to use lightning:RecordEditForm for Event Standard Object But not dispalying any data .Can anyone help me how to create lightning component for event Object which should display lookup custom fields of event in my custom component.
This is my code below,
Insertertion of AddInsurance__c object  is working fine ,But only once i need to insert and rest of time i need to update
trigger UpdatePatient on Contact (after insert) {
   
       // List<Contact> contactList = new List<Contact>();
        Contact con = [Select Id,Insurance__c,InsuranceSec__c,InsuranceTeri__c,InsurancePri__c,InsuranceSecd__c,
                       InsuranceTerit__c from Contact  where Id IN : Trigger.New];
        List<String> insuranceName = new List<String>();
        insuranceName.add(con.Insurance__c);
        insuranceName.add(con.InsuranceSec__c);
        insuranceName.add(con.InsuranceTeri__c);
        System.debug('insuranceName ====>'+insuranceName);
        
        Map<String,Id>  MapInsu =new  Map<String,Id>();
        List<Add_Insurance__c> addinsurances=new List<Add_Insurance__c>();
        List<Insurance__c> listInsurance=[Select Id,Patient__c,Name,Address__c, Co_Pay__c,Group_Number__c,Insured_Id__c,Address_1__c, State__c, City__c, Zip__c, Payer_Id__c
                                          from Insurance__c  where Name IN :insuranceName];
        System.debug('listInsurance ====>'+listInsurance.size());
        
        List<string> insNamelIst = new List<string>();
        for(Insurance__c ins : listInsurance){
            MapInsu.put(ins.Name,ins.Id);
        }
        for(Contact c : Trigger.New){
            Id insuranceId;
            for(String nam: insuranceName){
                if(c.Insurance__c ==nam && String.isNotBlank(c.Insurance__c)){
                    insuranceId = MapInsu.get(nam);
                    Add_Insurance__c addins=new Add_Insurance__c();
                    addins.Insurance__c=insuranceId;
                    addins.Patient__c=c.Id;
                    addins.From__c=c.From__c;
                    addins.To__c=c.To__c;
                    addins.Insurance_Type__c=c.Bill_Type__c;
                    addins.Insured__c=c.P_Insured_Name__c; 
                    addins.Status__c=c.Insurance_Status__c;
                    addins.Co_Pay__c=c.Copay__c;
                    addins.Group_Number__c=c.Group_No__c;
                    addins.Insured_Id__c=c.Insured_IdPri__c;
                    addins.Source_of_Payment__c=c.Source_Of_Payment__c;
                    addins.Insured_DOB__c=c.DOBpri__c;
                    addins.Insured_Gender__c=c.Insured_Gender__c;
                    addins.Relationship__c=c.Relationship__c;
                    addinsurances.add(addins);
                    System.debug('1 ====>'+listInsurance.size());
                    
                }else 
                    if(c.InsuranceSec__c == nam && String.isNotBlank(c.InsuranceSec__c)){
                        insuranceId = MapInsu.get(nam);
                        Add_Insurance__c addins=new Add_Insurance__c();
                        addins.Insurance__c=insuranceId;
                        addins.Patient__c=c.Id;
                        addins.From__c=c.FromSec__c;
                        addins.To__c=c.ToSec__c;
                        addins.Insurance_Type__c=c.Bill_TypeSec__c;
                        addins.Insured__c=c.Insured_NameSec__c; 
                        addins.Status__c=c.Insurance_StatusSec__c;
                        addins.Insured_Id__c=c.Insured_IdSec__c; 
                        addins.Co_Pay__c=c.Co_PaySec__c    ;
                        addins.Group_Number__c=c.Group_NoSec__c;
                        addins.Source_of_Payment__c=c.Source_of_PaymentSec__c;
                        addins.Insured_DOB__c=c.Insured_DOBSec__c;
                        addins.Insured_Gender__c=c.Insured_GenderSec__c;
                        addins.Relationship__c=c.RelationShipSec__c;
                        
                        addinsurances.add(addins);
                        System.debug('2 ====>'+listInsurance.size());
                    }else
                        if(c.InsuranceTeri__c ==nam && String.isNotBlank(c.InsuranceTeri__c)){
                            insuranceId = MapInsu.get(nam);
                            Add_Insurance__c addins=new Add_Insurance__c();
                            addins.Insurance__c=insuranceId;
                            addins.Patient__c=c.Id;
                            addins.From__c=c.FromTeri__c;
                            addins.To__c=c.ToTeri__c;
                            addins.Insurance_Type__c=c.Bill_TypeTeri__c;
                            addins.Insured__c=c.Insured_NameTeri__c; 
                            addins.Status__c=c.Insurance_StatusTeri__c;
                            addins.Insured_Id__c=c.Insured_IdTeri__c; 
                            addins.Co_Pay__c=c.Co_PayTeri__c;
                            addins.Source_of_Payment__c=c.Source_of_PaymentTeri__c;
                            addins.Group_Number__c=c.Group_NoTeri__c;
                            addins.Insured_DOB__c=c.Insured_DOBTeri__c;
                            addins.Insured_Gender__c=c.Insured_GenderTeri__c;
                            addins.Relationship__c=c.RelationShipTeri__c;
                            addinsurances.add(addins);
                            System.debug('3 ====>'+listInsurance.size());
                        }
            }
        }
        insert addinsurances;
        System.debug('addinsurances ====>'+addinsurances.size());
        System.debug('addinsurances ====>'+addinsurances);
    
    
     
}
I have to create a lightning component for event object which overides standard add new event button......Can anyone help me.....