• Akiko Koizumi
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hi there,

I'm a beginner of VF code writing, and just managed to write a save button which redirects to the current page if any error, otherwise a different page, by coping the codes from https://salesforce.stackexchange.com/questions/194830/how-to-stop-firing-oncomplete-if-save-action-has-errors.
Then, I'm now trying to write the testing code but cannot cover the below part which prevents me to get 75% coverage.

Your kind guidance how to write test code covering the below would be highly appreciated!!


-------------------------------------------------------
public PageReference submit()
   {
     try {
            //navigate to view page
            PageReference pg = new PageReference('/'+ '0019000001UwnVS');
            pg.setRedirect(true);
            return pg;
     } catch (Exception ex) {
            System.debug('Error in submit ' + ex);
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.Error, ex.getMessage());
            ApexPages.addMessage(msg);
            return null;
}
}
----------------------------------------------------

Many thanks for your time and help.
Regards,
Akiko
Hi there,

I've encountered a problem... My trigger (before insert/update) for Account page seems to work unexpectedly and so strangely.
According to Debug log, user A fired the trigger for over 1000 account pages within a few minutes but the user A didn't access/edit the account pages. Besides, the lastmodifiedby of these account pages indicated another user, user B who never access to the pages as well.

Here is my trigger which is for populating text field "IPs_Copy__c" to judge if the rick text field  "IPs__c" is updated or not.

trigger UpdateIPsCopy on Account (before insert, before update) {
    For (Account A:Trigger.new){
        if(A.IPs__c != null) {
             A.IPs_Copy__c = A.IPs__c.left(100) ;
            }
         return;
        }
}

This strange updates had happened almost everyday in my org until the trigger was deactivated. 
Any possible scenario which causes this kind situation or any advice on what I should do to find the factor of this strange situation??   
You kind advice would be highly appreciated.
 
Hi there,

I've encountered a problem... My trigger (before insert/update) for Account page seems to work unexpectedly and so strangely.
According to Debug log, user A fired the trigger for over 1000 account pages within a few minutes but the user A didn't access/edit the account pages. Besides, the lastmodifiedby of these account pages indicated another user, user B who never access to the pages as well.

Here is my trigger which is for populating text field "IPs_Copy__c" to judge if the rick text field  "IPs__c" is updated or not.

trigger UpdateIPsCopy on Account (before insert, before update) {
    For (Account A:Trigger.new){
        if(A.IPs__c != null) {
             A.IPs_Copy__c = A.IPs__c.left(100) ;
            }
         return;
        }
}

This strange updates had happened almost everyday in my org until the trigger was deactivated. 
Any possible scenario which causes this kind situation or any advice on what I should do to find the factor of this strange situation??   
You kind advice would be highly appreciated.