• Nicolas Kadis
  • NEWBIE
  • 15 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
We are building a record edit form for a custom sObject.  When the user clicks into the lightning-input-field, and the user enters a value with decimals (ex. 123.456789), the value is displayed as such.  Once the user clicks away (changing focus), the value loses all of it's trailing decimals (displayed as 123).  Has anyone dealt with this issue?

Thanks
Hi Guys, 

Please could someone be so kind to help me with the Test Class to the Apex Trigger below;
 APEX TRIGGER:
Trigger SOSPCall_Counter on Task (after insert) {  
Set<Id> setClosedTaskAccountIds = new Set<Id>();
List<Account> listAccountUpdate = new List<Account>();
List<Account> listClosedTaskAccounts = new List<Account>();
List<Account> listUpdatedTaskAccounts = new List<Account>();
List<Account> listUpdatedAccounts = new List<Account>();

if(Trigger.IsAfter){
    if(Trigger.IsInsert  || Trigger.isUpdate) {
        for(Task t: Trigger.new) {
            if(String.valueOf(t.WhatId).startsWithIgnoreCase('001')) {
                if(t.Status.equalsIgnoreCase('Completed')){
                    setClosedTaskAccountIds.add(t.WhatId);
                    System.debug('@@@@Inside Completed@@@'+setClosedTaskAccountIds);
                }
               
                if(Trigger.IsUpdate){
                    if(Trigger.oldMap.get(t.Id).WhatId != t.WhatId){
                        if(t.Status.equalsIgnoreCase('Completed')){
                            
                            setClosedTaskAccountIds.add(Trigger.oldMap.get(t.Id).WhatId );
                            System.debug('@@@Inside Update Closed@@@'+setClosedTaskAccountIds);
                        }
                        
                    }
                }
            }
        }
    }
    
    
         
    listClosedTaskAccounts =[SELECT Id, Left_Message__c, RecordTypeId, Patient_Status__c,(Select Status From Tasks Where Status = 'Completed' AND Call_Reason__c = 'Left Message' )  
                             FROM Account 
                             WHERE Id =:setClosedTaskAccountIds
                             AND Patient_Status__c = 'Eligible'];

    System.debug('@@@@ListClosedTaskAccounts'+listClosedTaskAccounts );

    try{
        System.debug('@@@@listAccountUpdate'+listAccountUpdate);
        update listAccountUpdate;
    }catch(System.Exception e){
        System.debug('@@@error'+e.getMessage());
    }
    
    
     listUpdatedTaskAccounts =[SELECT Id, Left_Message__c, RecordTypeId, Eligibility_Date__c,Patient_Status__c, (Select Status From Tasks Where Status = 'Completed' AND Call_Reason__c = 'Left Message' )  
                             FROM Account 
                             WHERE Id =:setClosedTaskAccountIds
                             ];
    
    
    for(Account a : listUpdatedTaskAccounts)        
    {
     List<Task> ltsk = a.Tasks;
        if ((a.Left_Message__c <= 2) && (a.Patient_Status__c == 'Eligible'))  {
            a.Left_Message__c = a.Left_Message__c + 1;
            system.debug('ltsk.size()  line 67 ' + ltsk.size());
            system.debug('a.Patient_Status__c  line 68 ' + a.Patient_Status__c);
            system.debug('a.Left_Message__c    line 69 ' + a.Left_Message__c);
        }
        if ((a.Left_Message__c > 2) && (a.Patient_Status__c == 'Eligible'))  {
            a.Left_Message__c = 0;
            a.Patient_Status__c = 'Non-Responsive Member';
            system.debug('ltsk.size()  line 74 ' + ltsk.size());
            system.debug('a.Patient_Status__c  line 75 ' + a.Patient_Status__c);
            system.debug('a.Left_Message__c    line 76 ' + a.Left_Message__c);
        }
    update listUpdatedTaskAccounts;
    System.debug('***LOOK MA WE MADE IT***Update happened');
          
}


}

TEST CLASS
@isTest
private class SOSPCall_CounterTest{
    
  @isTest
  static void setupTestData(){
    Account acc = new Account(LastName = 'LastName870', Patient_Status__c = 'Eligible');
    Insert acc; 
      
    Task tsk = new Task(Status = 'Completed', Call_Reason__c = 'Left Message', Subject = 'This is a Test', WhatId = acc.Id);
    Insert tsk;  

  }
  static testMethod void test_TaskTrigger(){
   test.startTest();
    List<Account> account1_Obj  =  [SELECT Id,LastName,Patient_Status__c,Left_Message__c from Account];
    System.assertEquals(1,account1_Obj.size());  
    Task task_Obj = new Task(Status = 'Completed', Subject = 'This is a Test', Call_Reason__c = 'Left Message');
    Insert task_Obj; 
   test.stopTest();
  }
}

for some reasons oblivious to me. the Test Class is not working.

I uploaded a class implementing the Database.batchable interface into our live environment. It ran with a couple of errors and I decided to remove it and go another route.

 

The problem is that I now seem to be unable to remove the class. I tried cleaning out the contents of the class, like thus:

 

 

global class CalcSummaryBatch {	
}

 

 

The class above saved successfully without any errors, but Salesforce still refuses to allow me to delete the class, or save it as Inactive.

 

Here's the error that I'm getting: "This apex class is referenced elsewhere in salesforce.com. Remove the usage and try again.: Apex Job - xxxxxxxxxxxxxxxxxxx."

 

Here's the log under Setup > Monitoring > Apex Jobs. I double-checked, and all jobs are at a Completed status:

(There are about 20 such messages as the one below, all with status "Completed", and all the Apex Job Ids are listed as why the class cannot be deleted, in the error above)

Action
 Submitted Date
Job Type
Status
Status Detail
Total Batches
Batches Processed
Failures
Submitted By
Completion Date
Apex Class
Apex Method
 <nothing listed here>
 4/10/2011 11:00 PM Batch Apex
Completed
 First error: Attempt to de-reference a null object 0 0 1 xxx 4/10/2011 11:00 PM CalcSummaryBatch  <nothing listed here>
...