How to save an apex class?

How to save an apex class?

Module 4: Creating an Apex Class

  1. In Salesforce, click your name in the upper right corner of the screen. In the dropdown menu, click Developer Console.
  2. In the Developer Console, click File > New > Apex Class.
  3. Implement the class as follows:
  4. Click File > Save to save the file.

How to save apex code?

2 Answers. There is a Save Option in the File Menu. It is also bound to the keyboard short cut CTRL+S. If you open a new file it asks for class name and automatically saves to your org.

How do I add a class in Apex?

Create an Apex Class

  1. If you haven’t already, log in to Trailhead, then launch your Trailhead Playground by clicking Launch at the bottom of this page. This opens your Trailhead Playground in a new tab.
  2. Click.
  3. From the File menu, select New | Apex Class.
  4. For the class name, enter OlderAccountsUtility and then click OK.

How to create an account in apex class?

Create an Apex class named AccountTriggerHandler that contains a public static method called CreateAccounts to accept the List of Account objects. For each Account record, before saving, ensure that the ShippingState field has the same value as the BillingState field.

How to test class save function in apex?

First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name] I have required field Name on the Account object in SFDC, but Since I’m mocking the Account with a Name attribute shouldn’t my test class save function work?

How to write an apex trigger before saving?

For each Account record, before saving, ensure that the ShippingState field has the same value as the BillingState field. Write an Apex trigger named AccountTrigger that fires before records are inserted.

What to do if your apex test fails?

If this fails too, try to use System.debug () in your Apex Test class and use the Salesforce developer console and their logs to follow your error. Maybe this helps.