Posts

Showing posts from 2016

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>

Finally passed Developer I/II transition exam

Ever since I registered for tranistion exam in August, I kept on postponing the exam till today. Finally, I passed the exam today. Happy to share my knowledge on the exam. Just simply follow the below topics mentioned in study guide to crack the exam: Describe the capabilities of base-system objects such as sharing objects, history objects, metadata objects, multi-currency, and Chatter objects. Describe the different capabilities of and use cases for the various Salesforce development platforms (Heroku, Fuel, Force.com). Describe how to design code that accommodates multi-language, multi-currency, multi-locale considerations. Describe the implications of compound data types in Apex programming. Describe the interactions between Visualforce/Apex with Flow/Lightning Process Builder. Given a scenario, describe when and how to use Apex managed sharing. Describe the use cases for the various authentication techniques. Given a set of requirements, describe the process for designing

New acquistion by Salesforce, PredictionIO, for building Salesforce IQ

Salesforce has made another acquisition to build out its technology in machine learning and big data analytics: the company has acquired PredictionIO, a startup based out of Palo Alto that had developed an open source-based machine learning server. Read this article by TechCrunch for furthur information: http://techcrunch.com/2016/02/19/salesforce-acquires-predictionio-to-build-up-its-machine-learning-muscle/

My insights on Date And Datetime fields

I would like to share my recent experience with Date fields and timezone. Scenario 1: Created a date field 'CustomDate__c'. I configured a validation rule which says , CustomDate__c > Today() Problem: There are different users from different timezones, who can update the record. So, when two users from different timezones say PST(UTC-8), SGT(UTC+8) try to update this record, assuming that Today is Feb 8 2016 according to SGT, SGT User updates 'CustomDate__c' to Feb 8 2016. Validation rule won't fire this time. Now, when PST user tries to update another field on the same record, this user encounters validation error as Today according to this user is Feb 7th 2016. Scenario 2: I had two date fields 'Submission Date' & 'Approved / Rejected Date' on an object. These fields get updated whenever record is submitted for approval & when record is approved/rejected using Field updates in Approval process. Field Updates are con

How to log mails being sent from Salesforce?

This post helps you learn how to log outgoing e-mails sent from Salesforce. E-mails can be sent through two ways: Workflow e- mail alerts. Mails stent from Apex ( Using single e-mail or Mass e- mail) Mails sent from Apex can be logged easily by creating a custom object and inserting records into it, whenever an e- mail is sent. How to log the e- mails sent through workflow rules? Here comes to the rescue  E-mail services .  With the help of Email services, you can create an email service address and give this address in   Additional Addresses section while configuring the workflow e- mail alert. You can write the logic for inserting/logging the e- mail into the custom object in the Inbound handler.