• Alfonso de la Cuadra Martinez
  • NEWBIE
  • 0 Points
  • Member since 2018
  • Salesforce Solution Analyst
  • Everis

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
Didn't expect to get hung up on this but I can not find the answer to this question. I created a Process Builder that updates a related record field (on the Opportunity object) when a record is created (Case Materials custom object) and when a specific field on the Case Materials object is changed. By setting it up to have it update when the field is changed i can't seem to also get it to update when the record is created. Any ideas on this oneUser-added imageUser-added imageUser-added imageUser-added image
I need Test Class for this Trigger


 trigger AOS_Case_Creation on Payment_Schedule__c (After Update) {
            List<Case> listC = new List<case>();
            Set<Id> regId=new Set<Id>();
            List<Case> Existingcase = new List<case>();
            Map<String,opportunity> mapReg=new Map<String,opportunity>();
            
            for(Payment_Schedule__c updatep:trigger.new){
                regId.add(updatep.opportunity__c);
                if(regId.size()>0){
                mapReg=new Map<String,opportunity>([SELECT Id,Name,AccountId,Account.PersonContactId  FROM Opportunity]);
                  } 
                   if(updatep.Display_Order__c == 1.0 && updatep.Status__c == 'Completed'){
                   Existingcase =[select Subject,Type from case where Opportunity__c=:updatep.Opportunity__c and Subject='Agreement for Sale'];
                   if(Existingcase.size()==0){
                   Case Cs= new Case();
                   cs.Payment_Schedule__c=updatep.id;
                   cs.ownerid=updatep.id;
                   Cs.Subject='Agreement for Sale';
                   Cs.Type='Agreement for Sale'; 
                   cs.Opportunity__c=updatep.Opportunity__c;
                   system.debug('================== cs.Opportunity__c ===================='+cs.Opportunity__c);
                   cs.AccountId=mapReg.get(updatep.Opportunity__c).AccountId;
                   system.debug('============================cs.AccountId======================='+cs.AccountId);
                   cs.ContactId=mapReg.get(updatep.Opportunity__c).Account.PersonContactId ;
                   listC .add(Cs);
                    
                    }
                 }
              }
               Insert listC;
}
Hi ,

I am doing sorting at the client side in helper class in lightning datatable using the below code. However, I am receiving null values in few columns and that is impacting the sorting of my data. How can I handle the null values to show at the last in the sorted table?

 sortData: function (cmp, fieldName, sortDirection) {
        var data = cmp.get("v.mydata");
        var reverse = sortDirection !== 'asc';
        data.sort(this.sortBy(fieldName, reverse))
        cmp.set("v.mydata", data);
    },
    sortBy: function (field, reverse, primer) {
        var key = primer ?
            function(x) {return primer(x[field])} :
            function(x) {return x[field]};
        reverse = !reverse ? 1 : -1;
        return function (a, b) {
            return a = key(a), b = key(b), reverse * ((a > b) - (b > a));
        }
    },
 
During the Cat Rescue module when verifying the Install Einstein Vision Apex Wrappers I am getting the following error:  There was an unexpected error in your org which is preventing this assessment check from completing: System.NullPointerException: null argument for JSONGenerator.writeStringField()