Wednesday, March 30, 2022

Salesforce Vlocity Dataraptor

 Vlocity DataRaptor moves data into and out of Vlocity applications. It's commonly referred to as an extract, transform, and load application.

DataRaptors allows you to read and write data to and from your Salesforce org.

 There are four types of DataRaptor: 

Turbo Extract, Extract, Transform, and Load.

Turbo Extract: Read data from a single Salesforce object type, with support for fields from related objects. Then select the fields to include. Formulas and complex field mappings aren’t supported.

Extract: Read data from Salesforce objects and output JSON or XML with complex field mappings. Formulas are supported. We can data from one or more Objects.

Transform: Perform intermediate data transformations without reading from or writing to Salesforce. Formulas are supported.

Load: Update Salesforce data from JSON or XML input. Formulas are supported.

With DataRaptor:

  • No coding is required because it abstracts queries.
  • Any DataRaptor can be saved, exported, and reused.

Monday, March 21, 2022

Salesforce Content Security Policy

 The Lightning Component framework uses Content Security Policy (CSP) to impose restrictions on content. 

The main objective is to help prevent cross-site scripting (XSS) and other code injection attacks.To use third-party APIs that make requests to an external (non-Salesforce) server or to use a WebSocket connection, add a CSP Trusted Site.

CSP is a W3C standard that defines rules to control the source of content that can be loaded on a page. All CSP rules work at the page level and apply to all components and libraries.

When you define a CSP Trusted Site, the site’s URL is added to the list of allowed sites for the following directives in the CSP header.

connect-src

frame-src

img-src

style-src

font-src

media-src


This change to the CSP header directives allows Lightning components to load resources, such as images, styles, and fonts, from the site. It also allows client-side code to make requests to the site.


Note: 

  • LEX - CSP header is approved only for your organization’s Lightning Experience.
  • Communities - CSP header is approved only for your organization’s Lightning Communities.
  •  You can’t load JavaScript resources from a third-party site, even if it’s a CSP Trusted Site. To use a JavaScript library from a third-party site, add it to a static resource, and then add the static resource to your component. After the library is loaded from the static resource, you can use it as normal.


Friday, March 4, 2022

Error : " Installing plugin @salesforce/lwc-dev-server... ! " when installing in my Visual Studio in Windows

Steps to fix the above Issue:

====================

1. Installation of Nodejs software and disconnect from office network VPN (if connected).

2. >Install node gyp by running 

      npm install -g node-gyp

    >In command prompt or whatever command-line interface you use.

3. And then after that, you can run 

     npm install --global --production windows-build-tools

4. And finally tried the below command it worked after 2 3 times..

     sfdx plugins:install @salesforce/lwc-dev-server

Thursday, January 20, 2022

Formula BestPractices

Tip 1: Put Every Function on a Separate Line

Place each function on its own line makes the formula easier to read and troubleshoot.

IF(AND(ISBLANK(myDate_c),active_c=true),"Missing Date","Not Applicable")

IF(

AND(

ISBLANK(myDate_c),

active_c=true

),

"Missing Date",

"Not Applicable"

)

Tip 2: Indent Sections Within Parentheses

When your formula involves multiple functions, indentation helps visually isolate each function and makes it easier to identify errors, such as misplaced characters.

In this example, with indentation, you see that the bulk of the formula sits within a single IF statement and that the AND statement contains two functions. Inside the AND statement, the function ISBLANK is enclosed in parentheses.

IF(

  AND(

    ISBLANK(myDate_c),

    active_c=true

  ),

  "Missing Date",

  "Not Applicable"

)

Indentation can also help you zero in on mistakes. 

IF(

AND(

ISBLANK(myDate_c)

),

active_c=true

),

"Missing Date",

"Not Applicable"

)

The indented layout makes it easy see the formula’s structure. You can quickly find and remove the extra character so that the AND statement is correctly formatted.


IF(

  AND(

    ISBLANK(myDate_c)

    ),

    active_c=true

  ),

  "Missing Date",

  "Not Applicable"

)

Tip 3: Write Statement and Function Names in Uppercase

All the examples here use uppercase letters for statement and function names, such as IF, AND, and ISBLANK.

Tip 4: Handle Null and Required Input Field Values

These examples reference a field called myDate__c and use the ISBLANK check to confirm that the field is populated. It’s important to verify the contents of any field in a formula. Without this verification, a formula can fail. 

IF(

  AND(

    ISBLANK(myDate__c),

    ISBLANK(mySecondDate__c),

    active__c=true,

    mySecondDate__c > myDate__c

  ),

  "Missing Date",

  "Not Applicable"

)

Friday, January 14, 2022

Salesforce API's

 Application Programming Interface(API), which is a software intermediary that allows two applications to talk to each other.

Each time you use an app like Facebook, send an instant message, or check the weather on your phone, you’re using an API.

Below are some of the APIS that we use in Salesforce.

API

When to Use

SOAP API 

Integrate your org’s data with other applications using standard SOAP protocols. 

REST API 

Access objects in your org using standard REST protocols. 

Metadata API 

Manage customizations in your org and build tools that manage your metadata model. 

Tooling API 

Build custom development tools for platform applications. 

Marketing Cloud API 

Expose Marketing Cloud capabilities with the REST API and get comprehensive access to most email functionality with the SOAP API. 

Bulk API 

Load, delete, and perform asynchronous queries on large data sets. 

Streaming API 

Send and receive notifications securely and efficiently. Notifications can reflect data changes in your org, or custom events. 

Connect REST API 

Build UI for Commerce, CMS-Managed Content, Experience Cloud Sites, Files, Notifications, Topics, and more. 

Mobile SDK 

While it’s technically a software development kit, it’s worth including here. Integrate Native or Hybrid mobile apps directly with Salesforce. 


Tuesday, December 28, 2021

Batch Apex

Batch Apex is asynchronous execution of Apex code, specially designed for processing the large number of records and has greater flexibility in governor limits than the synchronous code.

Need of Batch Apex:

  • When you want to fetch thousands of records or fire DML on thousands of rows on objects it is very complex in salesforce and it does not allow you to operate on more than certain number of records which satisfies the Governor limits.
  • But for medium to large enterprises, it is essential to manage thousands of records every day. Adding/editing/deleting them when needed.
  • Salesforce has come up with a powerful concept called Batch Apex. Batch Apex allows you to handle more number of records and manipulate them by using a specific syntax.

Database.Batchable interface has the following three methods that need to be implemented.

start() :

It collects the records or objects to pass to the interface method execute(), call the start() at the beginning of a BatchApexJob. This method returns either a Database.QueryLocator object that contains the records passed to the job.

execute() :

To do the required processing of each chunk of data, use the execute method. This method is called for each batch of records that you pass to it. This method takes a reference to the Database.BatchableContext object.

finish() :

To send confirmation emails or execute post-processing operations, we use finish(). This method is called after all batches are processed.

Note: The order of execution of batches is not guaranteed.

While Implementing the Batch Programming, we have to follow the below steps.

	Step 1: Create a Global Class, which should be implemented by the
		"Database.Batchable" Interface.
			
		Syntax:
			Global Class <ClassName> Implements Database.Batchable<SObject>
			{
				// Write the Logic..
			}
			
	Step 2: Provide the Implementation for the Interface Methods.
		
		Syntax:
			Global Class <ClassName> Implements Database.Batchable<SObject>
			{
				Global Database.QueryLocator Start(Database.BatchableContext <refName>)
				{
					// Write the Start Method Logic..
				}
				
				Global void Execute(Database.BatchableContext <refName>, List<SObject>
																recordsToProcess)
				{
					// Write the Execute Method Logic..
				}
				
				Global void Finish(Database.BatchableContext <refName>)
				{			
					// Write the Finish Method Logic..
				}
			}

	Step 3: Invoke the Batch Class.
			
			Step 1: Create the Object of the Batch Class.
				Ex:
					<BatchClassName> <objectName> = new <BatchClassName>();
					
			Step 2: Invoke the Batch Class by using "Database.ExecuteBatch()" method.
				Ex:
					ID jobId = Database.ExecuteBatch(<batchClassObjectName>);
					
								(OR)
								
		ID jobId = Database.ExecuteBatch(<batchClassObjectName>, batchSize);
					
			Ways to Invoke the Batch Class:
			-------------------------------
			1. We can Invoke from Execute Anonymous Window.
			2. We can invoke from Another Batch Class.
			3. We can invoke from "Visualforce Page".
			4. We can Schedule the Batch Job.

	Step 4: Track the Status of the Batch Class.
			
			Case 1: Track the Status from the Setup Wizard.
					Setup --> Monitor --> Jobs --> Apex Jobs.
					
			Case 2: Get the Status through Programming by Querying from "AsyncApexJob"
					object.
					
					AsyncApexJob jobDetails = [Select id, status, totalJobItems,							jobItemsProcessed,numberOfErrors, CreatedBy.Email from AsyncApexJob
														Where id =: <batchJobId> ];


Tuesday, November 23, 2021

Contract Testing

 Contract testing is a methodology for ensuring that two separate systems (such as two microservices) are  compatible and are able to communicate with one other.

 It captures the interactions that are exchanged between each service, storing them in a contract, which can then be used to verify that both parties adhere to it.

Contract testing goes beyond schema testing, requiring both parties to come to a consensus on the allowed set of interactions and allowing for evolution over time.

Pact is a code-first consumer-driven contract testing tool, and is generally used by developers and testers who code. The contract is generated during the execution of the automated consumer tests.

A major advantage of this pattern is that only parts of the communication that are actually used by the consumer(s) get tested. 

This in turn means that any provider behaviour not used by current consumers is free to change without breaking tests.

ES12 new Features