Ad
Ad
Ad
Tag

Slider

Browsing

In this article, we will try to understand why do we need segmentation and various ways we can segment data. Segmentation is targeting a desired set of Audiences from all the available Subscribers. For Example, if you want to launch a promotion to existing customers within the age group of 30 to 50 yrs then you could use age as your criteria to send promotional messages only to those customers instead of all the available customers. This would help you to target the right audiences and also help in a fewer number of Unsubscribes or IP Reputation. Segmentation also helps in increasing Higher Conversion rates and also Higher Clickthrough Rates.

Some of the business use cases for Segmentation are: 

  1. Segmentation could be done based on Age, Gender, Geolocation, Geographic location to Send personalized marketing messages.
  2. Segmentation could also be done based on Purchase History to show related Products.
  3. You could also filter desired Subscribers based on Personal Interests to promotional events.

The above-mentioned Scenarios are for illustration purposes and you could filter the audience based on any desired criteria.

Segmentation Tools:

  1. Segmenting Lists – Lists hold Subscriber information. Segmenting Lists can be done by using Group and Data filter.
  2. Segmenting Data Extensions – Data extensions can hold subscriber information or Related data. Segmenting Data extension can be done by using queries and Data filters.

In this article, we will try to understand the basics of AmpScript and insert records into Data Extension. In our previous article, we learned how to personalize using Ampscript. Ampscript code starts with %% and ends with %%. For example, if we wanted to get the dynamic value of Email from Data extension we can use %%Email%% on the Email template or on the cloud page. In case of Cloud page if we want to write an ampScript block then it starts with %%[ and ends with ]%%.

%%[  

/** Start of Variable Declarations **/

var @newName,@newEmail,@newPhone ,@website,@Submit

/** End of Variable Declarations **/

/** Start of Setting Dynamic/static values to desired variables **/

set @newName = RequestParameter(“name”)

set @newEmail = RequestParameter(“email”)

set @newPhone = RequestParameter(“phone”)

set @website = ‘Home Page’

set @Submit = RequestParameter(‘submit’)

/** End of Setting Dynamic/static values to desired variables **/

/** Validate if the variable has got the desired value before inserting into Data extension **/

If @submit == ‘Submit’ Then

InsertDE(“Customer_Form”,”Email”, @emailAddress, “Name”, @newName,”Phone”,@newPhone)

Endif

]%%

<label>Name:</label> <input name=”name” type=”text” value=”%%Name%%” />;

<label>Email:</label> <input name=”email” type=”text” value=”%%email%%” />

<label>Phone:</label> <input name=”phone” type=”number” value=”%%phone%%” />

<input name=”submit” type=”submit” value=”Submit” />

In the above code snippet, we have started our ampscript code with %%[ and then we declared variables using var keyword. Every variable must be declared/starts with @. We have declared newName, newEmail, newPhone for demo purposes.

var @newName,@newEmail,@newPhone,@website,@Submit

After declaring the variables the next step is to populate the variables with some values. We can set any value to the variable as it can hold text or numbers. In our scenario, we want to collect all the dynamic values such as name, email, phone and submit from the form which the customer has entered.  RequestParameter function in Ampscript helps in getting dynamic values from the form.

set @newName = RequestParameter(“name”)

set @newEmail = RequestParameter(“email”)

set @newPhone = RequestParameter(“phone”)

set @website = ‘Home Page’

set @Submit = RequestParameter(‘submit’)

After the Declaration of variables and setting/getting the values into variables, our next step is to use the variables and send it to data extension.

We always have to do conditional based logic to avoid unnecessary calls/errors to data extensions. To implement conditional logic we can use If condition/If else condition similar to other programming/Scripting languages. The syntax is a little different when compared to other programming/Scripting languages.

If (condition is true) Then

do this

Endif

In our scenario, we are checking if @submit variable is populated with value as submit then insert into data extension

If @submit == ‘Submit’ Then

InsertDE(“Customer_Form”,”Email”, @emailAddress, “Name”, @newName,”Phone”,@newPhone)

Endif

InserDE syntax helps in inserting data into Data Extension. The first parameter takes the data extension name and is a required field. We also need a column name on the Data extension for which the value has to be inserted.

Syntax

InsertDE(1, 2, 3)

OrdinalTypeDescription
1stringRequiredName of the data extension from which to insert the specified row
2stringRequiredColumn name used to build insert clause
3stringRequiredColumn value used to build insert clause

Usage

InsertDE(‘SomeDE’,’FirstName’,FirstName, ‘LastName’,LastName, ‘CreatedDate’,NOW())

In this article, We will try to understand Custom preference center and also compare it with the Profile Center/Subscription Center to get an overall understanding. Custom Preference Center provides the ability to have both Profile and Subscription information in one page. We can customize the preference center page with desired options that will allow Subscribers to opt-in/opt-out and also provide additional option to Unsubscribe from all the emails. If you are using a Marketing cloud connect then by default we will have to use Custom preference Center.

Ideas to use Preference Center:

  1. You want to provide few options to your Subscribers(Customers/Prospects/etc) such as asking them if they are interested in Getting Emails about birthday Coupons, Networking Events and Promotional Events.
  2. You could also ask customers to opt-in or opt-out into Newsletter, Feedback emails, Conferences, and Events. Since this is a cloud page you could retrieve the preferences from Data extension/Sales cloud and display the subscriber preferences.

You could build custom preference center by using Smart Capture form if you are using Lists. If you are using Data Extensions or Marketing cloud connect then you could use Cloud pages/AmpScript to capture the Subscriber preferences and Update Data Extensions/Sales Cloud /Service Cloud.

Considerations for using Preference Center vs Profile/Subscription Center:

 Understanding Wait Activity Attributes in Journey Builder

In this article, we will try to understand different Wait Activity attributes in Journey builder. Journey builder helps to define  1 to 1 relationship or personalized Customer/Prospect Journey using multiple channels such as Email, Mobile, PhysicalMail/Direct Mail, and Social Media.

Wait Activity is a configurable period that contacts are held between other Activities. During Wait Activity, Marketing cloud evaluates marketing cloud Contacts. We have to configure the time zone for the Wait Activities.

There are 3 different types of Wait Activities

  1. Wait by Duration
  2. Wait Until Date
  3. Wait by Attribute

Wait by Duration: This is the default wait activity that is displayed on the Canvas with the duration as 1 day. We Could increase the Wait duration to desired Days/Weeks/Months. Optionally we could also specify a time to make the Marketing contacts wait until the desired time by selecting “Extend Wait duration until specific time”.

Wait Until Date: Marketing cloud Contacts are held in the wait mode until the Specified date and time. Note: If the Contact reaches the wait activity after the specified date and time then the contact proceeds to the next activity Immediately.

Wait By Attribute: Marketing Cloud Contacts are held until the day and time specified on date attributes. For example, if we want to send a Birthday Email to the Customers/Contacts we could use the Wait By attribute with the date attribute field as Customer Birthdate field which stores customer birthday.

In this article, we will try to understand the basics of AmpScript and insert records into Sales cloud. In our previous article, we learned how to personalize using Ampscript. Ampscript code starts with %% and ends with %%. For example, if we wanted to get the dynamic value of Email from Data extension we can use %%Email%% on the Email template or on the cloud page. In case of Cloud page if we want to write an ampScript block then it starts with %%[ and ends with ]%%.

%%[  

/** Start of Variable Declarations **/

var @newFirstName,@newLastName,@newEmail,@newPhone ,@website,@Submit

/** End of Variable Declarations **/

/** Start of Setting Dynamic/static values to desired variables **/

set @newFirstName = RequestParameter(“Firstname”)

set @newLastName = RequestParameter(“Lastname”)

set @newEmail = RequestParameter(“email”)

set @newPhone = RequestParameter(“phone”)

set @website = ‘Home Page’

set @Submit = RequestParameter(‘submit’)

/** End of Setting Dynamic/static values to desired variables **/

/** Validate if the variable has got the desired value before inserting into Data extension **/

If @submit == ‘Submit’ Then

CreateSalesforceObject(“Contact”,3,”Email”, @emailAddress, “FirstName”, @newFirstName,”LastName”, @newLastName,”Phone”,@newPhone)

Endif

]%%

<label>Name:</label> <input name=”Firstname” type=”text” value=”%%FirstName%%” />

<label>Name:</label> <input name=”Lastname” type=”text” value=”%%LastName%%” />

<label>Email:</label> <input name=”email” type=”text” value=”%%email%%” />

<label>Phone:</label> <input name=”phone” type=”number” value=”%%phone%%” />

<input name=”submit” type=”submit” value=”Submit” />

In the above code snippet, we have started our ampscript code with %%[ and then we declared variables using var keyword. Every variable must be declared/starts with @. We have declared newName, newEmail, newPhone for demo purposes.

var @newFirstName,@newLastName,@newEmail,@newPhone,@website,@Submit

After declaring the variables the next step is to populate the variables with some values. We can set any value to the variable as it can hold text or numbers. In our scenario, we want to collect all the dynamic values such as name, email, phone and submit from the form which the customer has entered.  RequestParameter function in Ampscript helps in getting dynamic values from the form.

set @newFirstName = RequestParameter(“Firstname”)

set @newLastName = RequestParameter(“Lastname”)

set @newEmail = RequestParameter(“email”)

set @newPhone = RequestParameter(“phone”)

set @website = ‘Home Page’

set @Submit = RequestParameter(‘submit’)

After the Declaration of variables and setting/getting the values into variables, our next step is to use the variables and send them to Sales cloud/Service Cloud.

We always have to do conditional based logic to avoid unnecessary calls/errors to data extensions. To implement conditional logic we can use If condition/If else condition similar to other programming/Scripting languages. The syntax is a little different when compared to other programming/Scripting languages.

If (condition is true) Then

do this

Endif

In our scenario, we are checking if @submit variable is populated with value as submit then insert into Sales cloud/Service cloud.

If @submit == ‘Submit’ Then

CreateSalesforceObject(“Contact”,3,”Email”, @emailAddress, “FirstName”, @newFirstName,”LastName”, @newLastName,”Phone”,@newPhone)

Endif

 Block users from Logging into Salesforce during Deployments

In this post, We will try to understand how to stop users from logging into Salesforce when deployments are going on. Have you ever wondered how salesforce displays a maintenance message to users? The answer to this question is Salesforce uses Login flows to display message to users. Lets see how we could use Login flows, Flows and Custom settings(Hierarchical) together to stop users from Logging into Salesforce during deployments.

Step 1: Creation of Custom settings

Create Custom settings with the desired name and for our demo purpose, we will call it Block users from Login. We need to create two fields (BlockUser and DisplayMessage) on the “Block users from Login” custom settings. Block user field will be a checkbox and the Display Message will be a text area field. If the checkbox is selected then the desired message from the Display Message field should be displayed to the users

Step 2: Creation of flow

Create a flow with the desired name. For demo purposes, we will call it as “Block users from Login Service”.

Get Records: From Left side, pane select Get records and drop it on to the main page. In this step, we are trying to get the records from our custom settings(Block users from Login) as shown in the image. Fill in all the mandatory fields and select the first record

Object – Block users from Login

Condition Requirements — Get all Block users from Login

Sort Order – Not Sort

How many records to store – only the first record

How to store the record data – Choose fields and assign Variables (Advanced)

Select Variable to Store Block users from Login

Record – {!blockusers}

Field – BlockUser__c

Field – DisplayMessage__c

After entering all the above information click on Done. With this activity, we have successfully created Get Records.

In the next step, we will try to check if the Block user field on the fetched Custom setting(Block users from Login) is set to true using the decision box.

Decision:: Drag and drop Decision box from Left palette onto the Main page.Enter the desired Label and API Name. In the outcome, order click on + and enter the below details. Give the desired Label and API Name and set the When to execute Outcome as “All conditions are Met”. In the Resource select the blockuser field as true using the Global constant field. Click on Save and connect Get Records with decision box.

Screen: From the Left palette select the Screen and drop it on the main page. Give the desired screen name on the Label/API Name in the Screen properties. In the configure frame select “Show Header” only.

Note: Make sure you unselect the “Show footer” or else users will be able to see a button and then navigate/login to salesforce.

Our end result of the flow should be as shown below and make sure you go back and activate your flow.

Login flows:

Create new Login flow with desired name and select the flow we have created(Block_users_from_Login_Service).  Select userlicense as Salesforce and set the desired profile that we want to block the users from Logging in. In my scenario, I wanted to block Users with Standard User profile from logging into Salesforce.

Testing:

Login with any  Standard profile user and we should be able to see the information message from our custom settings and stop users from navigating into salesforce.

Note: Once the deployment/Maintenance is complete make sure to uncheck the Blockuser__c field to allow users into salesforce

 Reporting Hack: Power of 1 a Game Changer in Reports

count down graphjc background for event opening

In this post, We will try to understand the importance of the Power of 1 field on Standard and Custom Objects which helps in Reporting. We could get high-level stats such as Owner Unique Counts, Unique records owned by a User for Parent objects, etc when we use this field in Reports. In the below example, We will create a Formula field on Standard objects such as Account / Opportunity and User and run a report on Opportunity to get the unique Accounts and unique owners.

Business Requirement: Show Unique Account Count based on Owner in an Opportunity report

Setup –> Object Manager–>Account –> Fields & Relationships –> New–>Forumla–>Account(Power of 1). You can give any desired name as the Field Name.

Make sure you set the Decimal Place as 0.

Enter the value as 1 and click on Next and deselect all Page Layout and provide Visibility to desired profiles.

Similarly, Create the Power of 1 field on Opportunity object as well.

Let’s see the power of 1 in action after adding the Power of 1 field on desired objects. We will try to create Opportunities with Products Report type for our demo purpose. I have selected with Opportunities with Products Report type and applied filters such as Created Date(Current FY) and Opportunity Status as Open.

From the above report, I cannot get the Unique count of the Accounts associated with opportunities. This is where Power of 1 field created on the Account record would help us in getting the desired result.

From the above image you could see there are 5 Account records(Duplicate) owned by Gary Smith and 9 Account records(Duplicate) owned by Sai Rakesh Puli. With the help of the Power of 1 formula field, we were able to get the Unique Account records owned by Gary Smith and Sai Rakesh Puli. These stats are very helpful when we want to get unique counts from any objects that we join on the Reports.

 Conditional Rendering in Lightning Web Components

In this post, We will try to understand how to Conditionally render different DOM Elements in Lightning Web Component. The power of Lightning web components comes from its ability to display dynamic or desired DOM Elements based on Conditional directive. Salesforce provides us with two if directives such as <if:true> and < if:false> in order to display desired DOM Element.

Html file(electric.html):

<template>

<div id=”electriccar” if:false={pageload}>

<div>Name: {name}</div>

<div>Description: {description}</div>

</div>

<div id=”regularCar” if:true={pageload}>

<div>Car Type: {cartype}</div>

<div> Mileage:{mileage} </div>

</div>

</template>

JavaScript file(electric.js)::  In Javascript file add details for the property and set pageload property as false as shown below.

import { LightningElement } from ‘lwc’;

export default class Electric extends LightningElement {

name = ‘Tesla’;

description = ‘Tesla is an Electric Car.’;

cartype = ‘Regular Car’;

mileage = ’30’;

pageload = false;

}

The above will display the following output as we have set the pageload property as false in javascript. In our HTML file(electric.html) we are comparing if:false directive with pageload property and since the value of false matches on both sides we are conditionally displaying Name and Description fields.

Try it in playground: https://developer.salesforce.com/docs/component-library/tools/playground

81. How to use @future Annotation in Apex?

Future method is used to run the process in a separate thread at a later point of time(when resources are available). For example, you can use the future annotation when making an asynchronous Web service callout to an external service. Without the annotation, the Web service callout is made from the same thread that is executing the Apex code, and no additional processing can occur until the callout is complete (synchronous processing).

global class MyFutureClass {

@future static void myMethod(String a, Integer i)

{

System.debug(‘Method called with: ‘ + a + ‘ and ‘ + i);

// Perform long-running code

}

}

82. What are the different considerations while implementing future method?

  • Remember that any method using the future annotation requires special consideration because the method does not necessarily execute in the same order it is called.
  • Methods with the future annotation cannot be used in Visualforce controllers in either getMethodName or setMethodName methods, nor in the constructor.
  • You cannot call a method annotated with future from a method that also has the future annotation. Nor can you call a trigger from an annotated method that calls another annotated method.

83. When do we use Batch Apex?

When we have large volumes of data and do not require business logic to be processed in realtime we can use or implement Batch apex. We can process upto 50 million records using Batch Apex.

84. What are the different methods in Batch Apex?

Batch apex runs in Asynchronous mode and consists of 3 methods.

Start – Start method is used to query the list of records

Execute – Execute method is used to process business logic

Finish – Finish method is used to send email or call a different batch job or do nothing.

85. What is the purpose of QueryLocator in Batch Apex?

Query locator is used in Start method of Batch apex and it gives the ability to process upto 50 million records.

86. What are the different types of interfaces used in Batch Apex?

There are 3 different interfaces in Batch Apex

1. Database.Batchable

2. Schedulable

87. What is batch job chaining?

We can launch other Batchjob from finish method of the first job. This is called batch job chaining.

88. How many batch jobs can be run in parallel?

We can run a maximum of 5 batch jobs parallelly.

89. How many batch jobs can be in Apex flex queued at any given point of time?

With the Apex flex queue, you can submit up to 100 batch jobs.

90. How can we invoke batch job from Developer console?

Example: We have a batch job AccountProcessBatch that needs to be executed with a default size. Then we can use the below command.

Database.executebatch(new AccountprocessBatch());

Dev Tip 3: Execute Batchjob from Anonymous Window/Dev Console

71. What is the difference between public class vs Global class?

Public – Public class is accessible only in the corresponding namespace

Global – Global Class is accessible across the Salesforce instance irrespective of namespaces.

72. What are different access modifiers in Apex?

public/private/global

73. What is difference between with Sharing vs without Sharing?

Any class that has With Sharing will enforce the Sharing rules for the current user.

Any class that has without sharing specified or no sharing specified then it runs in the context of system admin mode/system mode.

Dev Tip 7: Difference between With Sharing and Without Sharing in Salesforce

74. What is the default value for class when sharing is not specified?

By default, every class runs in System mode or Admin mode if we do not specify any sharing keyword.

75.  What is the purpose of  extends keyword in salesforce?

A class that extends another class inherits all the methods and properties of the extended class. A class can only extend one other class, but it can implement more than one interface.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_extending.htm

76. What is an Interface?

An interface is like a class in which none of the methods have 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.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_interfaces.htm

77.  What is the purpose of final keyword?

Final variables can only be assigned a value once, either when you declare a variable or inside a constructor. You must assign a value to it in one of these two places.

78. What is the purpose of Dynamic Apex?

Dynamic Apex enables developers to create more flexible applications by providing them with the ability to:

Access sObject and field describe information

Access Salesforce app information

Dynamic SOQL and SOSL queries provide the ability to execute SOQL or SOSL as a string at runtime, while dynamic DML provides the ability to create a record dynamically and then insert it into the database using DML

79. How to access Recordtypeid dynamically without using soql query?

Id recordTypeId = Schema.SObjectType.Lead.getRecordTypeInfosByName().get(‘Record Type Name‘).getRecordTypeId();

In the Record type Name mention your desired record type Name that is available in your org.

80. How to get the sobject describe result through dynamic apex?

To access the describe result for an sObject, use one of the following methods:

  • Call the getDescribe method on an sObject token.
  • Use the Schema sObjectType static variable with the name of the sObject. For example, Schema.sObjectType.Lead.
  • Schema.DescribeSObjectResult is the data type for an sObject describe result.
    The following example uses the getDescribe method on an sObject token:

Schema.DescribeSObjectResult dsr = Account.sObjectType.getDescribe();
The following example uses the Schema sObjectType static member variable:
Schema.DescribeSObjectResult dsr = Schema.SObjectType.Account;