Apex basics and Opportunity in Salesforce

Jira Code: SMT-6

This article briefs about Apex object-oriented language, its triggers, opportunity creation, and remote site access etc.

Apex 

Apex is an object-oriented language

Multi-tenant language

On demanding lang


How to initialize a variable in Apex
String method = ‘POST’;

Triggers

  1. Apex triggers are used to find the triggers.
  2. Apex can be invoked by using triggers. Apex triggers enable you to perform custom actions before or after changes to Salesforce records, such as insertions, updates, or deletions.
  3. A trigger is Apex code that executes before or after the following types of operations:
  • insert
  • update
  • delete
  • merge
  • upsert
  • Undelete

There are two types of triggers:

  • Before triggers are used to update or validate record values before they’re saved to the database.
  • After triggers are used to access field values that are set by the system (such as a record’s Id or LastModifiedDatefield) and to affect changes in other records, such as logging into an audit table or firing asynchronous events with a queue. The records that fire the after trigger is read-only.

How to navigate
Setup -> Build -> Develop -> Apex Triggers

Classes

  • A class is a template or blueprint from which objects are created. An object is an instance of a class.
  • A class can contain other classes, exception types, and initialization code.
  • An interface is like a class in which none of the methods has been implemented—the method signatures are there, but the body of each method is empty. To use an interface, another class must implement it by providing a body for all of the methods contained in the interface.

How to navigate

Setup -> Build -> Develop -> Apex Classes

Opportunity

Create an opportunity

Create New -> opportunity

View opportunity

Opportunities

Remote Site Access: Remote site settings. Salesforce allows you to access external website resources from a Salesforce application for your organization. You can access these external websites through Visualforce pages, Apex Callout, and via XmlHttpRequest calls.

Adding Remote Site Settings

  1. From Setup, enter Remote Site Settings in the Quick Find box, then select Remote Site Settings.
  2. Click New Remote Site.
  3. Enter a descriptive term for the Remote Site Name.
  4. Enter the URL for the remote site.
  5. Optionally, enter a description of the site.
  6. Click Save.

Leave a comment

Your email address will not be published. Required fields are marked *