Group Engagement in Salesforce

View group member engagement in a convenient report linked from each group. See the number of members, posts, comments, likes, questions, and answered questions in a single view for each group. This feature is available in Salesforce Classic only.

Anyone with permissions can view the group engagement report. Group owners, managers, and other users with permissions (for example, users with the “Modify All Data” and “Manage Unlisted Groups”) can quickly access this report by clicking Show Group Report below the group photo.


Check the below link for more information

https://releasenotes.docs.salesforce.com/en-us/spring16/release-notes/rn_chatter_group_engagement_reports.htm

Cheers!!!

Global Constant In Process Builder in Salesforce

Choose a global constant to set a value to null or an empty string. For example, choose $GlobalConstant.Null.

Two global constants are

1. $GlobalConstant.Null
2. $GlobalConstant.EmptyString

Scenarios for Process Builders:

1. While using update action in Process builder for Contact records and then if we want to clear Account field, then we can use $GlobalConstant.Null. We cannot use $GlobalConstant.EmptyString since the lookup field cannot be mapped to blank string.

2. While using insert or update action in Process builder and if we would like to update any field with blank value, then we can use $GlobalConstant.EmptyString.

Difference between IsBlank and IsNull - http://www.infallibletechie.com/2012/09/difference-between-isblank-and-isnull.html

Cheers!!!

Sample Partial DML Apex code in Salesforce

Sample Code:

List < Contact > conList = new List < Contact > {
new Contact(FirstName = 'Test0', LastName = 'Test0', Department = 'Finance'),
new Contact(FirstName = 'Test1', LastName = 'Test1', Department = 'Technology'),
new Contact(FirstName = 'Test2', LastName = 'Test2', Department = 'Finance'),
new Contact()
};

Database.SaveResult[] srList = Database.insert(conList, false);

for (Database.SaveResult sr : srList) {
if ( sr.isSuccess() ) {
// Develop code for sucessfully inserted contacts
System.debug('Successfully inserted contact. Contact ID: ' + sr.getId());
} else {
for ( Database.Error err : sr.getErrors() ) {
// Develop code for failed contacts
System.debug(err.getStatusCode() + ' : ' + err.getMessage() + ' : ' + err.getFields());
}
}
}


Cheers!!!

Simple Inbound REST API using Apex in Salesforce

Sample Code:

@RestResource(urlMapping='/Account/*')
global with sharing class sampleRest {
  
    @HttpGet
    global static Account doGet() {
        RestRequest req = RestContext.request;
        String memberId = req.requestURI.substring(req.requestURI.lastIndexOf('/') + 1);
        Account result = [SELECT Id, Name FROM Account WHERE Id = :memberId];
        return result;
    }
  
    @HttpPost
    global static String doPost(String name, String descrp) {
        Account a = new Account(Name = name, Description = descrp);        
        insert a;
        return a.Id;
    }

    @HttpDelete
    global static void doDelete() {
        RestRequest req = RestContext.request;
        String memberId = req.requestURI.substring(req.requestURI.lastIndexOf('/') + 1);
        Account memb = [SELECT Id FROM Account WHERE Id = :memberId];
        delete memb;
    }
    
}

To test in POSTMAN Client extension, check the below

1. Create a Connected App.




2. Create Auth. Provider.



3. Get the access_token first try GET, POST and DELETE.


GET


POST


DELETE


To test in Workbench, check the below

GET


POST


DELETE


Cheers!!!

Simple Outbound REST API with XML Response using Apex in Salesforce

Remote Site Settings:


Visualforce Page:

<apex:page controller="RESTAPIXMLResponseController">
    <apex:form>
        <apex:pageBlock>
            <apex:pageBlockSection>
                <apex:pageBlockSectionItem>Customer No: <apex:inputText value="{!strCustomerNo}"/></apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Fetch" action="{!fetchAPI}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
        
        <apex:pageBlock>
            <apex:repeat value="{!mapCustomer}" var="c">
                {!c} - {!mapCustomer[c]}<br/>                 
            </apex:repeat>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Apex Class:

public with sharing class RESTAPIXMLResponseController {

    public String strCustomerNo {get;set;}
    public Map < String, String > mapCustomer {get;set;}
    
    public RESTAPIXMLResponseController() {
    
    }
    
    public void fetchAPI() {
        mapCustomer = new Map < String, String >();
        String endpoint = 'http://www.thomas-bayer.com/sqlrest/CUSTOMER/' + strCustomerNo + '/';
        HTTP h = new HTTP();
        HTTPRequest req = new HTTPRequest();
        req.setEndPoint(endpoint);
        req.setMethod('GET');
        HTTPResponse res = h.send(req);
        Dom.Document doc = res.getBodyDocument();
        Dom.XMLNode customer = doc.getRootElement();
        for ( Dom.XMLNode child : customer.getChildElements() ) 
            mapCustomer.put(child.getName(), child.getText());
    }
    
}

Output:


Cheers!!!

Simple Outbound REST API with JSON Response using Apex in Salesforce

Remote Site Settings:


Visualforce Page:

<apex:page controller="RESTAPIJSONResponseController">
    <apex:form>
        <apex:pageBlock>            
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Fetch" action="{!fetchAPI}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
        
        <apex:pageblock>
            <apex:pageBlockSection>
                <apex:pageBlockTable value="{!listWrapper}" var="obj">
                    <apex:column value="{!obj.id}" headerValue="Id"/>
                    <apex:column value="{!obj.login}" headerValue="Login"/>
                    <apex:column value="{!obj.url}" headerValue="URL"/>
                    <apex:column value="{!obj.description}" headerValue="Description"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:pageblock>
    </apex:form>
</apex:page>

Apex Class:

public with sharing class RESTAPIJSONResponseController {

    public List < JSONWrapper > listWrapper {get;set;}
    
    public RESTAPIJSONResponseController() {
        listWrapper = new List < JSONWrapper >();
    }
    
    public void fetchAPI() {
        HTTP h = new HTTP();
        HTTPRequest req = new HTTPRequest();
        req.setEndPoint('https://api.github.com/users/hadley/orgs');
        req.setMethod('GET');
        HTTPResponse res = h.send(req);  
        JSONParser parser = JSON.createParser(res.getBody());
        listWrapper = (List < JSONWrapper >) JSON.deSerialize(res.getBody(), List < JSONWrapper >.class);
        /*
           If the response contains only one value instead list, then you can use the below code
           JSONWrapper obj = (JSONWrapper) JSON.deSerialize(res.getBody(), JSONWrapper.class); 
           listWrapper.add(obj);
        */
    }
    
    public class JSONWrapper {
        public String login {get;set;}
        public String id {get;set;}
        public String url {get;set;}
        public String repos_url {get;set;}
        public String events_url {get;set;}
        public String hooks_url {get;set;}
        public String issues_url {get;set;}
        public String members_url {get;set;}
        public String public_members_url {get;set;}
        public String avatar_url {get;set;}
        public String description {get;set;}
    }
    
}

Output:


Cheers!!!

How to download and setup Oxygen Eclipse for Force.com IDE?

1. Go to https://www.eclipse.org/downloads/eclipse-packages/.

2. Select 32 bit or 64 bit based on your computer.

To know whether your system is 32 bit or 64 bit, use the below link

http://www.infallibletechie.com/2013/06/how-to-know-whether-my-system-is-32-bit.html


3. Click Download.


4.  Extract the downloaded file.

5. Move the extracted eclipse folder to your desired location. In my case, I have moved the extracted folder eclipse to C drive.

6. Create a folder with the name Workspace inside the eclipse folder.


7. Double click eclipse.exe to open Eclipse.


8. Click Browse and select the folder created in step 6. Click Launch to open.


9. Navigate to Help --> Install New Software.


10. Click Add.


11. Enter the below Details.

Name: Force.com IDE

Location: https://developer.salesforce.com/media/force-ide/eclipse45


12. Click Select All and click "Next".


13. Click Next again.

13. Accept the agreement and click "Finish".

14. Restart Eclipse after installation.

15. Navigate to Windows --> Perspective --> Open Perspective --> Other.


16. Select Force.com and click Open.


17. Navigate to File --> New Force.com Project.


18. Enter Project name and credentials. Click "Finish" button to create the force.com project.

References:
https://developer.salesforce.com/docs/atlas.en-us.eclipse.meta/eclipse/ide_install.htm
https://developer.salesforce.com/docs/atlas.en-us.eclipse.meta/eclipse/ide_install_troubleshooting.htm

Cheers!!!

Chatter Streams in Salesforce

Chatter streams are custom feeds that you create by combining multiple related feeds. Look for streams on your Chatter home page. Create up to 100 streams that each combine posts from up to 25 different feeds and feed types. Create streams that combine feeds from people, groups, and records, like accounts, opportunities, cases, and more.

1. Go to chatter tab and get started. Click + to create a chatter stream.


2. Enter details and Save Chatter Streams Salesforce.


You will be able to see all the feeds related to the records selected. You can select records across all objects.

Cheers!!!

How to get matching records from Duplicate Rule failure in Salesforce using Apex?

Sample Code:

        Contact contact = new Contact(LastName = 'Test');
        Set < Id > duplicateIds = new Set < Id >();
Database.SaveResult saveResult = Database.insert(contact, false);

        if ( !saveResult.isSuccess() ) {
            for ( Database.Error err : saveResult.getErrors() ) {
                if ( err instanceof Database.DuplicateError ) {
                    Database.DuplicateError duplicateError = (Database.DuplicateError)err;
                    Datacloud.DuplicateResult duplicateResult = duplicateError.getDuplicateResult();
                    Datacloud.MatchResult[] matchResults = duplicateResult.getMatchResults();
                    Datacloud.MatchResult matchResult = matchResults[0];
                    Datacloud.MatchRecord[] matchRecords = matchResult.getMatchRecords();
                    for ( Datacloud.MatchRecord matchRecord : matchRecords ) 
                        duplicateIds.add(matchRecord.getRecord().Id);
                }
            }
        }

Reference Link - https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Datacloud_DuplicateResult.htm

Cheers!!!

Desk.com to Service Cloud Migration

If you are interested in Desk.com to Service Cloud Migration, check the below link for considerations.

https://org62.my.salesforce.com/sfc/p/#000000000062/a/0M0000005YV6/ghp0ivVVphPCz83zZ4Y7AoUkA6lPd3.yPKu5jkvThCM

Before you move into the implementation phase of your project, it’s best to have some important pieces in place. These include a solid project team and a set of requirements for go-live. This unit helps you put together a preliminary structure for executing a successful move to Service Cloud.

When it comes to implementing a new solution, there are a lot of components to consider. What do you roll out in Phase 1 versus Phase 2 (or beyond)? For example, do you need all of those macros moved over to Service Cloud immediately, or is this transition a good time to do some spring cleaning and only migrate the few that your team regularly uses?

Note:
There are few trailhead modules specially designed for migration of Desk.com to Service Cloud.

Cheers!!!

{“error”:“unsupported_grant_type”,“error_description”:“grant type not supported”}

When you face {“error”:“unsupported_grant_type”,“error_description”:“grant type not supported”} error, put all the information in the body instead of header.


1. If you are using POST, check whether the Content-Type is set as application/x-www-form-urlencoded.

2. Check whether setBody() has correct body data.

Cheers!!!

Salesforce Interview Questions with Answers Part 44

1. Describe some SF best practices and patterns that you have used? 

https://developer.salesforce.com/page/Apex_Design_Patterns

2. What is tuning performance? How do you increase it?

https://developer.salesforce.com/docs/atlas.en-us.salesforce1.meta/salesforce1/vf_dev_best_practices_performance.htm

3.What is apex design pattern? What is continuous pattern?

https://developer.salesforce.com/page/Apex_Design_Patterns

4.One child record per one master details how would you achieve it?

http://www.infallibletechie.com/2013/05/how-to-create-one-to-one-relationship.html

5.Salesforce design pattern

https://developer.salesforce.com/page/Apex_Design_Patterns

6.What is asynchronous Apex?

@future, Queueable Interface, Batch Class.

7. What is the future method?

http://www.infallibletechie.com/2012/08/future-annotation-in-salesforce.html

8. What is Queueable Apex?

http://www.infallibletechie.com/2016/08/queueable-apex.html

9. What is Batch Apex?

http://www.infallibletechie.com/2012/05/batch-apex.html

10.How many batch job can be in the single queue?

You can only have 25 classes scheduled at one time. You can evaluate your current count by viewing the Scheduled Jobs page in Salesforce or programmatically using the Force.com Web services API to query the CronTrigger object.

While the batch apex states:

Up to five queued or active batch jobs are allowed for Apex.

10.The difference between Workflow and Process builder? 

http://www.infallibletechie.com/2016/07/what-is-difference-between-process.html

12.What is flow?

http://www.infallibletechie.com/2014/05/visual-workflow-in-salesforce.html

13. What are the steps for inbound, and out bound web service calls?

https://developer.salesforce.com/blogs/developer-relations/2015/06/integrating-force-com.html

14. How to handle the error in Apex (class)?

https://developer.salesforce.com/page/An_Introduction_to_Exception_Handling

15. Salesforce Case Management?

http://www.infallibletechie.com/2014/12/case-management-in-salesforce.html

Cheers!!!

Conditional Rendering in Lightning Component using aura:if in Salesforce

Lightning Component:

<aura:component>

<aura:attribute name="strTest" type="String"/>

<aura:if isTrue="{!not(empty(v.strTest))}">
True
<aura:set attribute="else">
False
</aura:set>
</aura:if> 

</aura:component>

Check the below link for more methods

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/expr_functions.htm

Cheers!!!

What Are Data Integration Rules in Salesforce?

Data integration keeps your data up-to-date. When you activate a data integration rule, Salesforce immediately checks your existing records against a data service to see if new data is available. New records are checked when they're saved. Based on your rule settings, your records are updated with new data.

Data integration rules let you specify the object and fields to update and the data service to use. In addition, the rules let you control triggers and workflow rules for the records that are updated.

1. Navigate to Data Integration Rules.


2. Activate Data Integration Rules.


3. Add Data Integration Rules related list.

4. Create a Formula field as below.


Formula:

'Accuracy - ' & TEXT(BillingGeocodeAccuracy) & ' - Lattitude - ' & TEXT(BillingLatitude) & ' - Longitude - ' & TEXT(BillingLongitude)

Output:


Cheers!!!

Default Values formula in Picklist Fields Salesforce

Starting from Summer '17 Release, this is available.


Cheers!!!

Session-Based Permission Sets in Salesforce

Use a session-based permission set to allow functional access only during a predefined session type.


Flows or SOAP API can be used to activate and deactivate the session-based permission set.

Flow Components to Activate and Deactivate the permission Set


Cheers!!!

How to create Global Picklist Value Sets from existing pick list field in Salesforce?

1. Edit the pick list field.

2. Click Promote to Global Value Set button.


3. Enter Label and Name. Click "Promote to Global Value Set" button.


Cheers!!!

How to enable Field Service Lightning in Salesforce

1. Go to Field Service Settings.


2.  Enable Field Service Lightning and click "Save" button.


Cheers!!!

Salesforce Shield

Salesforce Shield lets customers see who is doing what with sensitive data, know the state and value of their data going back up to ten years, and encrypt sensitive data at rest, while still preserving business functionality. It is declarative.

Salesforce Shield includes three core services:

Event Monitoring 

  • Captured daily
  • 28 event types captured


  1. Apex Callout 
  2. Async Report 
  3. Content Transfer 
  4. Logout 
  5. Report Export 
  6. Time-Based Workflow
  7. Apex Execution 
  8. Bulk API 
  9. Dashboard 
  10. MDAPI Operation 
  11. REST API 
  12. URI
  13. Apex SOAP 
  14. Change Set Operation
  15. Document Attachment Downloads
  16. Multiblock Report
  17. Salesforce1 Adoption (UI Tracking)
  18. Visualforce
  19. Apex Trigger 
  20. Content Distribution
  21. Login 
  22. Package Install 
  23. Sandbox
  24. API Content
  25. Document Link
  26. Login As 
  27. Report 
  28. Sites


  • 30 days of events retained
  • Log files are exposed via the API
  • Data available the following day

Below can be done using the log captured

  • Use Analytics Cloud, or:
  • Import data into any BI tool
  • Build an app
  • Use pre-built AppExchange apps
  • Export to CSV file

Field Audit Trail
Note:
Field Audit Trail is similar to Field History tracking. It is not like Set Up Audit trail.

Field Audit Trail captures the full life cycle of your data so you can quickly determine the state and value of your data for any date, at any time and define the data retention policy so data is deleted when no longer needed.

Tracks up to 10 years of history with 60 fields per object.

Now you can define rules for how your data is stored in production and archive environments with point-and-click tools.

Platform Encryption
Shield Platform Encryption gives your data a whole new layer of security while preserving critical platform functionality. It enables you to encrypt sensitive data at rest, and not just when transmitted over a network, so your company can confidently comply with privacy policies, regulatory requirements, and contractual obligations for handling private data.

Cheers!!!

How to set up Snap-Ins - Salesforce?

1. Be in Lightning Experience. If you are in Salesforce classic, kindly switch to Lightning Experience.

2. Go to Snap-Ins.


3. Click New Deployment.


4. Enter and select details. Click "Create" button.


Cheers!!!