Posts

Showing posts from 2017

regular expressions for pattern

Common Matching Expressions Regular Expression Description . Matches any character ^regex Finds regex that must match at the beginning of the line. regex$ Finds regex that must match at the end of the line. [abc] Set definition, can match the letter a or b or c. [abc][vz] Set definition, can match a or b or c followed by either v or z. [^abc] When a caret appears as the first character inside square brackets, it negates the pattern. This pattern matches any character except a or b or c. [a-d1-7] Ranges: matches a letter between a and d and figures from 1 to 7, but not d1. X|Z Finds X or Z. XZ Finds X directly followed by Z. $ Checks if a line end follows. Metacharacters The following metacharacters have a pre-defined meaning and make certain common patterns easier to use, e.g.,  \d  instead of  [0..9] . Regular Expression Description \d Any digit, short for  [0-9] \D A non-digit, short for  [^0-9] \s A whitespace character,

Best Practices for Apex code

1. Bulkify the code       Bulkifying Apex code refers to the concept of making sure the code properly handles more than one record at a time. When a batch of records initiates Apex, a single instance of that Apex code is executed, but it needs to handle all of the records in that given batch. For example, a trigger could be invoked by a Force.com SOAP API call that inserted a batch of records. So if a batch of records invokes the same Apex code, all of those records need to be processed as bulk, in order to write scalable code and avoid hitting governor limits.      Here is an example of written code that only handles one record: trigger accountTrigger on Account ( before insert, before update) { /** * This only handles the first record in the Trigger.new collection * But if more than one Account initiated this trigger, those additional records * will not be processed */ Account acct = Trigger . new [ 0 ]; List < Contact > contacts = [ s

salesforce questions and answers

Image
1. What is Lightning? A lightning Component framework is a UI framework for developing responsive web apps, Single Page Application FrameWork, It Supports partitioned multi-tier component development that bridges the client and server, It uses JavaScript on the client-side and Apex on the server-side. 2. What is the use of Lightning Component Framework? Out-of-the-box set of components, Event-driven Architecture, Framework optimized for performance. 3. What is a component?  Self-contained and reusable units of an app, A single line of code can use the entire app wherever want. 4. What is an aura framework? Aura is an open-source framework. Enables building apps completely independent of your data in Salesforce. 5. What is lightning App Builder? The Lightning App Builder, To build apps visually, without code, quicker than ever before using off-the-shelf and custom-built Lightning components. Make your Lightning components available in the Lightning