Posts

Deploy profile metadata changes easily with simple Python script

Moving profile changes to Salesforce environments is a difficult/irritating/troublesome task. This post helps to make developer's life easier when deploying profile changes.Let me explain you with a business scenario. Business Scenario: Universal Containers is using Salesforce Platform for their business automation. They have different sandboxes for development teams. They use Tortoise SVN (Subversion) for version control.  Developers check-in their code, metadata(profiles, objects, layouts etc) to SVN. As continuous integration is setup in their organisation, checking into SVN automatically deploys the changes to sandboxes. Problem: Universal Containers have around 90 profiles in their Salesforce environment. Developers have to update the metadata files of all profiles whenever there is a new field created which is time consuming. Solution: We are going to create a Python  script which copies the profile permissions to all the profiles. For example, consider the below fi

Connect API : Post Feed to chatter with @mention using Apex

This post helps you know how to post feed to chatter with @mention in Apex. The  ConnectApi   namespace (also called  Chatter  in  Apex ) provides classes for accessing the same data available in  Chatter REST API . Use  Chatter in Apex  to create custom  Chatter  experiences in  Salesforce .

How to prepopulate fields on Standard layout? - Tooling API to the rescue

              Have you ever wondered populating a field's value while creating a new record on a standard detail page? You can do so by assigning the value to field id. But how do I get the field Id? By grabbing the Id from Inspect Element? If so, then, how do you manage the field ids accross different Salesforce orgs/environments? We have Tooling API to the rescue. Use Tooling API when you need fine-grained access to an org’s metadata. Tooling API’s SOQL capabilities for many metadata types allow you to retrieve smaller pieces of metadata. You can use Tooling API using REST/SOAP. We can also use these   Apex Wrappers & Javascript Wrappers(jsForce) . Thank you very much Andrew Fewcett , James Loghry & Shinchi Tomita for creating these wonderful wrappers! These are awesome, timesaving & very helpful! Let's get into hands-on in retrieving the field id using JSForce library. In the above example, Bug is a custom object, and Type is a custom field in Bu

How to deploy Processes in Process builder using ANT?

Image
How to deploy Processes in Process builder using ANT? This post helps you learn how to deploy Processes in Process builder using ANT . Processes are stored as Flows in metadata . Use the below markup in your package.xml to deploy Process . Where FLOW_NAME  is combination of API Name and version of the process. Below screenshot explains how to give the FLOW_NAME. Note!: Even if you are deploying an active process, the process will be deployed in  in-active status in target environment. So, you have to activate the process in target environment manually once it get's deployed. Where can I notice the syntax of FLOW_NAME? You can observe the syntax of FLOW_NAME  when you upload the process using change set. To add a process to change set, select the component type as Flow Definition. After uploading the changeset, you can see a change in Type and API Name   of the component. Did you observe one more thing from the screenshot? Though there are two versions of th

New Beta Architect Certifications by Salesforce

A very good news for Salesforce architect certification aspirants! Salesforce is going to launch two new certifications in Architect category. As a part of this, it launched beta exams which are free. Below are the details of two certification exams: 1. Salesforce Certified Integration Architecture Specialist 2. Salesforce Certified Development Lifecycle and Deployment Specialist Pre-registration for both beta exams opens March 23, 2016 in Webassessor. Space is limited so please register early. The beta testing period runs April 1 - 8, 2016. Please note, beta exams are available at testing centers only and cannot be completed through online proctoring. Beta exams contain a larger number of questions compared to our master exams, and pass/fail results are generally made available 4 - 6 weeks after the beta testing period closes. Exam results will be based only on the questions that are selected for the master exam. Once they perform beta analysis, you will receive your pass/fa

Small things in Apex which we can achieve in a smart way! - Part 2

Hope you guys enjoyed reading Part1. Here we go! Below mentioned are few things which you might have missed while coding. Happy reading!!. Mixed Save Actions on sObject Lists:                While working in Trigger or an ApexClass, we generally prepare different lists of multiple object types and perform DML operations for each sObject list. For example, to update accounts, contacts & cases we prepare List<Account>, List<contact> & List<case>, then we update each list separately which consumes unnecessary DML operations.                Instead, we can simply put all the three lists into a single sObject list and perform the DML only once.                Let's get into details on how this works. In the above code snippet contactList   contains 3 records say c1, c2, c3,  accountList has 2 records say a1, a2 and caseList has 2 records case1,case2. Salesforce processes multiple object types in a list in Chunks . The sObjList  has 3 chunks now.    

Small things in Apex which we can achieve in a smart way! - Part 1

This article discusses on the small things that we overlook while writing code in Apex. You might have got habituated in doing the below explained items in your own usual way, but there is still a better way to achieve them. Try it! 1. Sending records to @future method:                   We all know that future methods run in asynchronous mode, and will not accept Sobject types as parameters. Consider this scenario, where we need to send List<Account> to a future method. As we can't send the List<Account>, we usually send the record ids to future method, and then query the records in future method.                  An alternate way to do this is we can send the the serialized list to future method. We can serialize the List<Account> using Json.serialize() method. We can deserialize the list in future method using Json.deserialize(). Below is the syntax to serialize & deserialize List<Account>: //Serializing list of accounts. List<Account>