Skip to main content

Posts

Showing posts from February, 2020

Database Methods

Database Methods Apex contains the built-in Database class, which provides methods that perform DML operations and mirror the DML statement counterparts. These Database methods are static and are called on the class name. Database.insert() Database.update() Database.upsert() Database.delete() Database.undelete() Database.merge() Unlike DML statements, Database methods have an optional allOrNone parameter that allows you to specify whether the operation should partially succeed. When this parameter is set to false , if errors occur on a partial set of records, the successful records will be committed and errors will be returned for the failed records. Also, no exceptions are thrown with the partial success option. This is how you call the insert method with the allOrNone set to false . Database.insert(recordList, false); The Database methods return result objects containing success or failure information for each record. For example, insert and update...

DML Manipulation

Manipulate Records with DML Create and modify records in Salesforce by using the Data Manipulation Language, abbreviated as DML. DML provides a straightforward way to manage records by providing simple statements to insert, update, merge, delete, and restore records. Because Apex is a data-focused language and is saved on the Lightning Platform, it has direct access to your data in Salesforce. Unlike other programming languages that require additional setup to connect to data sources, with Apex DML, managing records is made easy! By calling DML statements, you can quickly perform operations on your Salesforce records. This example adds the TCS  account to Salesforce. An account sObject is created first and then passed as an argument to the insert statement, which persists the record in Salesforce. // Create the account sObject Account acct = new Account(Name='TCS', Phone='(123)456-7890', NumberOfEmployees=100); // Insert the account by using DML insert ...

What is trigger in Salesforce?

Trigger Triggers are the set of actions that are called automatically once DML operation is performed on any object. A Trigger is an Apex code that executes before or after inserting or modifying a record based on the condition provided.  There are different types of triggers based on the action going to be performed. They are Before Triggers and After Triggers. Triggers allow modification of another record of the same type or different type. Before Trigger: They are fired before any DML operation on an object. They are mainly used for validating records.  After Trigger: They are fired after DML operation on any object. (or) used to access field values that are set by the system (such as a record's Id or LastModifiedDate field), and to affect changes in other records. The records that fire the after trigger are read-only. DML operation supported by apex trigger: Before Insert After Insert Before Update After U...

Python programming language

Python It's top in the list of programming languages. It is widely accepted as the best programming language to learn first. Python is fast, easy-to-use, and easy-to-deploy that is being widely used to develop sca lable web applications. YouTube, Instagram, Pinterest, SurveyMonkey are all built-in Python. Python provides excellent library support and has a large developer community. The programming language provides a great starting point for beginners. Talking about those who are looking for a better job, you should definitely learn Python. A lot of startups are using Python as their primary backend stack and so, this opens up a huge opportunity for full-stack Python developers.  Sample “Hello World!” program in python: print "Hello World!" Pros: Simple and easy-to-understand syntax. Object-Oriented Programming-driven. Supports imperative and functional programming. Extensive library. Supports multiple platforms (Web and mobile computing). Python...