• srujith chintha 4
  • NEWBIE
  • 20 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 9
    Replies
  • Print out all positive integers from 1 to 100, inclusive and in order.
  • Print messages to standard output, matching the Sample Output below.
  • In the output, state whether each integer is ‘odd’ or ‘even’ in the output.
  • If the number is divisible by three, instead of stating that the number is odd or even, state that the number is ‘divisible by three’.
  • If the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is ‘divisible by two and three’.
  • Design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic.
  • Print out all positive integers from 1 to 100, inclusive and in order.
  • Print messages to standard output, matching the Sample Output below.
  • In the output, state whether each integer is ‘odd’ or ‘even’ in the output.
  • If the number is divisible by three, instead of stating that the number is odd or even, state that the number is ‘divisible by three’.
  • If the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is ‘divisible by two and three’.
  • Design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic.
  • Print out all positive integers from 1 to 100, inclusive and in order.
  • Print messages to standard output, matching the Sample Output below.
  • In the output, state whether each integer is ‘odd’ or ‘even’ in the output.
  • If the number is divisible by three, instead of stating that the number is odd or even, state that the number is ‘divisible by three’.
  • If the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is ‘divisible by two and three’.
  • Design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic.
  • Print out all positive integers from 1 to 100, inclusive and in order.
  • Print messages to standard output, matching the Sample Output below.
  • In the output, state whether each integer is ‘odd’ or ‘even’ in the output.
  • If the number is divisible by three, instead of stating that the number is odd or even, state that the number is ‘divisible by three’.
  • If the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is ‘divisible by two and three’.
  • Design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic.
  • Print out all positive integers from 1 to 100, inclusive and in order.
  • Print messages to standard output, matching the Sample Output below.
  • In the output, state whether each integer is ‘odd’ or ‘even’ in the output.
  • If the number is divisible by three, instead of stating that the number is odd or even, state that the number is ‘divisible by three’.
  • If the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is ‘divisible by two and three’.
  • Design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic.
@isTest private class TestAccountDeletion { @isTest static void TestDeleteAccountWithOneOpportunity() { // Test data setup // Create one account with one opportunity by calling a utility method Account[] accts = TestDataFactory.createAccountsWithOpps(1,1); // Perform test Test.startTest(); Database.DeleteResult result = Database.delete(accts[0], false); Test.stopTest(); // Verify that the deletion should have been stopped by the trigger, // so check that we got back an error. System.assert(!result.isSuccess()); System.assert(result.getErrors().size() > 0); System.assertEquals('Cannot delete account with related opportunities.', result.getErrors()[0].getMessage()); } }
 1.when i am trying in developer console its showing TestDataFactory variable does not exit
public class CalloutClass { @future(callout=true) public static void makeCallout() { HttpRequest request = new HttpRequest(); // Set the endpoint URL. String endpoint = 'http://yourHost/yourService'; request.setEndPoint(endpoint); // Set the HTTP verb to GET. request.setMethod('GET'); // Send the HTTP request and get the response. HttpResponse response = new HTTP().send(request); } }

1.how to make callout by adding trigger
 
1.The Apex class must be called AccountHandler and be in the public scope
2.The Apex class must have a public static method called insertNewAccount
3.The method must accept an incoming string as a parameter, which will be used to create the Account name
4.The method must insert the account into the system and then return the record
5.The method must also accept an empty string, catch the failed DML and then return null.
  • Print out all positive integers from 1 to 100, inclusive and in order.
  • Print messages to standard output, matching the Sample Output below.
  • In the output, state whether each integer is ‘odd’ or ‘even’ in the output.
  • If the number is divisible by three, instead of stating that the number is odd or even, state that the number is ‘divisible by three’.
  • If the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is ‘divisible by two and three’.
  • Design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic.
Hi All,
I'm new to salesforce and started working on Trailhead's. I facing issue with the Trigger Challenge. Here is the triger code im writing 

trigger AccountAddressTrigger on Account (before insert) {
    for(Account a : Trigger.new){
        if(a.Match_Billing_Address__c && a.BillingPostalCode != null){
            a.ShippingPostalCode = a.BillingPostalCode;
        }
    }
    
}

but i'm getting the following error. Not sure where i'm doing wrong. can someone please help me here. Thanks in advance.

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, TestTrigger: execution of AfterInsert caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.TestTrigger: line 3, column 1: []
This is the Challenge:

To pass this challenge, create an Apex class that inserts a new account named after an incoming parameter. If the account is successfully inserted, the method should return the account record. If a DML exception occurs, the method should return null.The Apex class must be called 'AccountHandler' and be in the public scope.
The Apex class must have a public static method called 'insertNewAccount'.
The 'insertNewAccount' method must accept an incoming string as a parameter, name the account after the parameter, insert it into the system and then return the account record.
The 'insertNewAccount' method must also accept an empty string, catch the failed DML and return null.


My Class:

public class AccountHandler {

    public static Account insertNewAccount (String accName, Account a) {
         try{   
          a.name = accName;
    
         insert a;
        return a;
        }
        catch(Exception e) {
            return null;
        }
    }    
}



User-added image


Throwing this error, how many times i modified the class.
what is the correct class.?