Ye Meri Life Hai - Chirag Mehta

Be Good & Do Good!

Author: Chirag Mehta (page 1 of 133)

Paryushan … Be Soulful, Be Sensitive, Be forgiving … Be Human!

Ack: Atit Shah! (Received this forward, This is not a comprehensive draft but throws many apt points. Read and follow the ones you think are rational.)

Paryushan… A festival of 8 days which is one of the greatest festivals in Jainism!

Unfortunately, this festival has been reduced to food by today’s generation … What to eat ..What not to eat .. what should be eaten and how many fasts can be done!!

However, food is only a part and a path to achieve the actual focus of Paryushan!

So what is the focus of Paryushan? Why is Paryushan called the greatest of festivals and why is it so important?

The answer is in a two-pronged approach and like 2 sides of a coin both are equally important and cannot exist independently without the other

The first is

1. Disconnect to connect.
We observe in todays generation that they are constantly on their smartphones and disconnected from the real world .. conversations have been reduced to emojis, lol and # … Relationships have become virtual, temporary and based on wants rather than meaningful long lasting ones

But perhaps the most important relationship, The one with your soul has been completely forgotten so much so that we aren’t even aware that we are the soul and not the body. For us our outward appearance and comforts have become the daily driving factor of our lives … What did you eat today? Which movie did you see? Have you seen that new dress? In all this drama The soul is simply lost and forgotten or relegated to 5 mins of superficial prayer at a temple because everyone in the house seems to be doing it.

Paryushan is a festival which tells you to truly disconnect from all outwardly distractions to connect to your self to connect to who you really are. Do we know who we are or are we now defined by Our Rolexs Guccis and Armanis?

Notice there are 2 words .. DISCONNECT and Connect .. you absolutely need to disconnect from your current form of thinking and distractions to truly connect to your soul. It needs a radical shift in thought.

And so all the types of tapas (there are 12 to be exact) and vyakhans are designed to do just that … Help you on the path of disconnecting and dive deep within to an unexplained unexplored world so amazing that it has has the power to not only shake your current misguided foundation which is a just an illusion but to cement another foundation so strong that you will be unshakable by anyone all at the same time.

Infact the very word Upvas does not mean to go hungry but real or literal meaning is to abstain from ALL DISTRACTIONS which hinder you from going within. A form of self control if you will.

It is ABSOLUTELY NOT OK to fast and watch television or just sleep and laze around because then it completely negates the purpose of the fast. A Fast if done correctly may not be the cause but it definitely is the catalyst and the first step to going within.

So again I will iterate here that Upvas/other forms of Tapa is a catalayst to help you disconnect from the outside world and go within which is the real focus of Paryushan is to initiate a process which will ultimately let you know yourself and then be at peace with yourself.

The second and more important focus of Paryushan is summed up by this statement

2. We are so desperate to be understood that we forget to be understanding.

This statement works on the Givers gain philosophy and if you are truly understanding and sensitive to each and everyone around you; you will be understood. You must give what you want to recieve! Sounds easy right? Well it’s definitely easier said than done… However the beauty of Jainism is that it takes this philosophy multiple steps ahead and asks you to be understanding and sensitive to each every living being or every soul you encounter and not just humans.

To make it easy I recommend starting at the core … Your family and colleagues you interact with everyday and then slowly widening that circle. Try and be understanding to a handful of people for 8 days atleast .. be patient with them, try not to get angry and then slowly widen the time frame and your net when ultimately your at peace with the whole world all the time! A Jain tirthankar is at peace with every single soul every single second.

Again this philosophy is not only to be practiced for these 8 days but rather every moment of your conscious state ..However for all of us who don’t implement it all the time or have frequent lapses Paryushan is the time to kickstart it with new renewed fervour.

So what about forgiveness then? Where does that feature in all of this as it is preached by all our sadhus? What is Pratikraman and why is it so important (much more important than fasting alone)

When self realisation dawns you will know that your not the perfect being and there are many actions by us which causes hurt and harm to other souls. So the next logical step after being understanding is to set things right for all the wrong we have done.

As it is said a good apology has 3 parts to it …

I accept what I have done wrong
I am sorry for what i have done
How can I set things right.

Once we accept that we are wrong and take suitable corrective action only then can we be at peace with the other soul.

A Pratikraman if understood is the most amazing tool given to us by the tirthankars and is designed in such a way so as so make you remember all the wrong things you have done and ask for forgiveness. It can be summed up in 2 words Micchami Dukkadam!

However it is in no way to be understood that it’s ok to continue doing wrong and then doing a Pratikraman or simply saying Micchami Dukkadam to amend those things because the Pratikraman covers only the first 2 parts of the apology. You still have to goto the concerened person and make things right and more importantly try not to repeat the same mistake.
It would be completely moot to say Micchami Dukkadam to a friend when you haven’t been talking to your cousin for the last 10 months.

Lastly think of Paryushan just like a marathon, which is held annually but you train for it every single day and with each marathon you try and up your game… 8 Kms 21kms and 42kms.
Similarly create personal specific goals for each Paryushan, (i will not hurt X amount of people, I will try to disconnect atleast for 20
Minutes a day, I will understand and learn more about Jainism, I will do atleast 1 type of fast atleast once a month) practice some of it every day and progress further every single year. Make these the 8 days of reckoning till you are the best human you have ever encountered in your own eyes because your conscience never lies to you, even if you may!

Jai Jinendra!

P.S : So a few of you might ask why no vegetables for these 8’days … Well the simple answer to that is that it’s scientifically proven that certain foods creates certain reactions in the body and mind which are suitable for different tasks. Ideally one should fast so it detoxes the body but spiritually and more importantly it detoxes your mind of all negative emotions. A must to lead a healthy lifestyle. This is also been proven by science and is recommended once a month. If you can’t completely abstain from food then the diet given in Paryushan is the most optimal for the same detoxification process which helps you in your dive into the infinte wisdom stored within.

Dreamforce’17 Global Gathering Meetup : My Trailhead

Navi Mumbai UG met at Thane, India for Dreamforce’17 Global Gathering Meetup (#DF17GG).

View details of event @

At this Global Gathering, attendees got access to the latest content and hands-on learning from Dreamforce. We were joined by 200+ other community groups around the world to host this special meetup with all the latest Salesforce content and takeaways from Dreamforce for every skill-level and all backgrounds.

I had the opportunity to present on “My Trailhead” topic.

myTrailhead enables organizations to leverage the power of Trailhead, Salesforce’s online learning platform, to reinvent learning at their company – with their brand and content. myTrailhead is designed to create an inspiring and revolutionary culture of learning in the workplace by providing the tools needed to make learning customized, gamified, and fun at every step of an employee’s learning journey.


India Dreamin’ : Develop & publish “5 star” AppExchange app

After long wait, here comes a post 🙂

Recently I was part of community speakers at India Dreamin’ 2017 event. There-in, I presented on Develop & publish “5 star” AppExchange app.

The presentation covered following points:

  • Step by Step guide on how to build and publish app
  • Ensure the app meets all security standards
  • Ensure customer requirements are met over
  • Ensure customer support is round the clock and the best
  • Listen to customer requirements and add them in your road-map
  • And at last, always follow-up with your client to garner reviews and share your app in their circle

Darling, You are here!

Darling, You are here!

An Angel enrapturing me by her astounding presence. I am amazed how clear you are, a rain-washed sky. Your skin shimmers like a rainbow on a cloudy day. Your smile makes me dance, leaving all stress and pains of life aside.

On 24 April 2016,  you entered our world and world was never beautiful as you made it for us.

Waiting to hear, Love you Daddy!

Happy Month’Birthday Princess!

Bye Bye Orkut … Download/Backup Your Orkut Scraps, Testimonials, and Photos

Bye Bye Orkut .. Those golden days, scrapping each other, viewing photos, last viewed by, checking friends friends …. oh dear Golden days and awesome memories around orkut will end in next few hrs, sad 🙁

If you are still an active ORKUT user or if you have some data there that you’d like to download, there are easy ways to do so. Before you begin, know that you can’t download information from other people’s accounts. Google only lets you download data from your own Orkut account. This also means you won’t be able to download the scraps or testimonials you sent to other people. You can only download the scraps and testimonials you’ve received and their comments.

If you want to save the pictures and scraps to your computer, you can use Google Takeout. This service lets you download all your Orkut account data in a zip file. The file will contain HTML files and photos. Google says you can download your profile, scraps received, testimonials received, activities and your photos from Orkut. You will be able to download your Orkut data using Google Takeout until September 2016. This is how to download your Orkut data:

1) Head to Google Takeout and sign in if you haven’t already done so.
2) Click “Choose services” and then select Orkut.
3) Click “Create archive” and wait till the archive is ready. If you like, you can leave the page, and receive an email when the archive is ready.
4) Once the archive is ready, click Download. Google says there’s no limit on how many times you can download your Orkut information.

How to define filename for a Visualforce generated PDF (renderAsPdf) ?

When rendering a visualforce page as a PDF, the filename of the PDF (by default) is the name of the page which may be annoying at times. Annoying as every time the file is generated, it will be generated with same name and will lead to cause confusion with the user. If opened multiple times, files will be saved as invoice.pdf, invoice[1].pdf, invoice[2].pdf … and so on. Ideally you should be able to define the name of the generated PDF but that’s not something well documented anywhere.

To rescue (as always) comes Salesforce blogs/forums [1][2].

In order to set filename for generated PDF you need to set the Content-Disposition header. In constructor of the Visualforce controller use below code:

Apexpages.currentPage().getHeaders().put('content-disposition', 'attachment; filename=AccountReport.pdf'); //In case you want to download pdf

Apexpages.currentPage().getHeaders().put('content-disposition', 'inline; filename=AccountReport.pdf'); //In case you want to open pdf in browser

Please Note : If you want to make the file name dynamic you will need to refer to several RFCs on how to correctly encode the filename. E.g. if it contains spaces it will need to be quoted. If there are non-ASCII characters or it is longer than 78 characters it needs to be Hex encoded (RFC 2184).


Visualforce Jquery Select List with Search feature

Lets say you have a requirement where-in you are displaying a select-list (picklist) on a visualforce page for user selection. Based on user selection you are doing some operation. Now if this select list is too big (i.e., is list of  50+ items), then its really hard to select a particular item as visualforce select list doesn’t support searching of options inside a select list.

Inorder to provide similar functionality, I google’d and found a really nice jquery plugin – Chosen. Convert long, unwieldy select boxes much more user-friendly.

Below is simple to follow steps to incorporate same in a visualforce page.

Step1 : Import necessary Jquery+Chosen JS & CSS into Static Resource. Download @

Step2 : Include above imported js and css in visualforce page

<!– Include Chosen JQuery Plugin Javascript and CSS Files –>
<apex:includeScript value=”{!URLFOR($Resource.chosen_jquery_plugin, ‘chosen.jquery.js’)}”/>
<apex:includeScript value=”{!URLFOR($Resource.chosen_jquery_plugin, ‘chosen.jquery.min.js’)}”/>
<apex:includeScript value=”{!URLFOR($Resource.chosen_jquery_plugin, ‘docsupport/prism.js’)}”/>
<apex:stylesheet value=”{!URLFOR($Resource.chosen_jquery_plugin, ‘docsupport/prism.css’)}”/>
<apex:stylesheet value=”{!URLFOR($Resource.chosen_jquery_plugin, ‘chosen.css’)}”/>

Step3: Include script to convert select into select with search

j$ = jQuery.noConflict();
j$(document).ready(function() {

Salesforce – Generating Stub Code(Jar) from a WSDL

When integrating any non native application (JAVA or NET or ..) with salesforce, you need to have the salesforce API library in place that can be referred/used as a referenced library in project being developed. This library is the the one that acts as face to salesforce i.e., intermediary between your application and salesforce.

Simple yet important step of such type of integration is to generate stub code (jar file) from wsdl (salesforce enterprise or partner wsdl) and though such a simple step, we (at least I) always forget (or I should say cant recall easily) the step on how to generate same.

Below are three easy steps to generate stub code (jar) from a wsdl:

  1. Download Enterprise (Partner) WSDL by navigating to Setup -> API – > Enterprise (Partner) WSDL (right click and save file as “abc.wsdl”, ensure extension “.wsdl” is there).
  2. Download Web Service Connector (WSC) [1]. The Web Service Connector (WSC) is a high performing web service client stack implemented using a streaming parser. WSC also makes it much easier to use the API (Web Services/SOAP or Asynchronous/REST API). You can download a pre-built WSC jar file from:
    Now generate Stub Code from a WSDL. Run wsdlc on the WSDL you have downloaded:

    java -classpath wsc-xx.jar *wsdl* *jar.file*
    java -jar wsc-23.jar *wsdl* *jar.file*

    wsdl is the name of the WSDL file
    jar.file is the name of the output jar file that wsdlc generates
    You can include an optional argument: -Dpackage-prefix=myprefix

  3. Now write your client application. Add wsc-xx-min.jar and jar.file (generated by wsdlc) to your classpath, then compile and run your client application.

With this you are all set with stub code / library and ready to make soap API calls to Salesforce.

Enjoy Coding!


Javascript (jQuery) code to fetch Salesforce Lead Convert Custom Field Mappings (in terms of API Names)

Yesterday came across a requirement to list down Lead Convert Custom Field Mappings in terms of API Names ie Lead Field1__c maps to Account/Contact/Opportunity Field1__c. Salesforce UI doesn’t give that option to extract same. Neither any metadata API got that, really strange that there’s no way I can extract Lead Convert Custom Field Mappings (in terms of API Names). Is there any? please help in case I’m missing some standard way of extracting that out?

Easiest option could have been that I sit down and do manual and tedious way of reading each field label finding its API Name and record the same in excel, but this doesn’t seem viable option for an org with 100+ lead convert field mappings. As I couldn’t find one using all standard approaches, I started thinking of wicked ways of achieving it. And as usual Javascript (jQuery) comes to rescue party!

Login to Salesforce Org in Chrome or FF Browser,
Navigate to lead convert field mappings page (Select Your Name | Setup | Customize | Leads | Fields | Map Lead Fields),
Open Javascript Console,
Now load jQuery first (you can do same by loading any existing jQuery booklet or userscript too) by executing below code in JS Console.

var jq = document.createElement('script');
jq.src = "//";

Now comes the main code which will output LeadFieldAPIName, Account/Contact/Opportunity Field APIName, Account or Contact or Opportunity. Execute below code too in JS Console.

//Traverse across all Select elements
$j("select").each(function () {

//Consider only the ones with a mapping selected
if (this.value != '') {

//Fetch Object Name to which this particular Lead field is mapped, whether its Account or Contact or Opportunity
var objectname = $(this).find('option:selected').text().split(".")[0];

//Tricky Part : As this lead convert field mappings page doesn’t store Lead field API Names, it only contains lead field ID (15 digit SFDC ID) so we will have to do AJAX request of LEAD field detail webpage to fetch LEAD API Name corresponding to lead field ID
var contentText = $.ajax({url: "/" +,async: false}).responseText;

//In fetched content, search and extract field API Name
var fromfield = $(contentText).find('td').filter(function () {
return $(this).text().indexOf('API Name') === 0;

//Similarly AJAX request for Account/Contact/Opportunity field detail page to fetch respective field API Name
contentText = $.ajax({url: "/" + this.value,async: false}).responseText;

//In fetched content, search and extract field API Name
var tofield = $(contentText).find('td').filter(function () {
return $(this).text().indexOf('API Name') === 0;

//Output LeadAPIName, Account/Contact/Opportunity APIName, Account or Contact or Opportunity
console.log(fromfield + ',' + tofield + ',' + objectname);


Please Note:

  • This isn’t most neat and recommended way, so if you come across something really clean and less network consuming solution please share your solutions in comments below
  • I’m not an expert in jQuery, so there might be obvious and recommended ways of coding jQuery and my above coding might sound nascent way of handling jQuery, so please ignore my lack of knowledge around jQuery and help me to optimize same.
  • Fetching Lead/Account/.. Field API Name from Field ID might be done using other ways too (describe API Calls?), but thought of doing it in just one script, so did that using AJAX calls and parsing retrieved webpage content
  • As always, feedback/suggestions are always welcome

Auto-Refresh Salesforce Dashboard every 5, 10 or 15 … seconds, minutes or hours …

UPDATE (7 Oct 2014) : This is now available in form of chrome extension, Try it out @ AppExchange or or

Is there a way we can have Salesforce Dashboard Auto-Refresh every few seconds (not recommended) or every x minutes or every x hours …?

Standard Out of box functionality does allow to refresh dashboard, but the lowest level of refresh interval is DAILY or WEEKLY or MONTHLY.

Lets say you want to have(display) a Sales Monitor always LIVE showing real time data, how do you achieve that?

There’s no direct way of doing it, but JS (as always) comes to the rescue …

  1. Log in to Computer (which is streaming output to LIVE monitor) , open Chrome browser (will try to update the script later to make it work in all browsers)
  2. Login to Salesforce and Navigate to desired Dashboard
  3. Delete url from  address/url bar, type (or copy+paste) below code and hit enter in address/url bar. (Make sure javascript: at start is there, chrome does remove it when copy pasted)

    javascript:function autorefresh() {document.getElementById('refreshButton').click();setTimeout(autorefresh, 5000);}autorefresh();

  4. Now do a full screen and enjoy Dashboard Live Monitor 🙂

 Please Note:

  1. 5000 represents 5000 milli seconds ie 5 seconds, so change the same according to your requirements ie if you want it to refresh every minute change the value to 60000
  2. This is not a recommended way, as its a tweak and might not work in future. (But as of now its working great and helps in having real time monitor of your favorite dashboard, so enjoy!)

Might be this can be an admin tool or a chrome extension, will try to make one when I get time and chance 🙂

Older posts