Skip to main content

Posts

Showing posts from August, 2018

How to get Record Type developer name in Apex ?

Hi All, Before summer 18, we used to write SOQL query to get developer name of a particular record type, now SOQL query is not required.  This is my earlier post where recordtypeinfo method has been explained. What can we do using those methods. https://salesforceworld4u.blogspot.com/2014/11/how-would-we-get-recordtype-id-and.html 1. How can we get Record Type Id of an object ?     a.  Lets assume we know the record type name. say its "Inquiry". Id objectRecordTypeId = Schema.SObjectType.CASE.getRecordTypeInfosByName().get('Inquiry'). getRecordTypeId (); System.debug('objectRecordTypeId ---'+objectRecordTypeId );       b.  Lets assume we know the record type developer name, say its "DevInquiry". Id objectRecordTypeId = Schema.SObjectType.CASE. getRecordTypeInfosByDeveloperName() .get('DevInquiry').getRecordTypeId(); System.debug('objectRecordTypeId ---'+objectRecordTypeId ); 2.  How can we get record type develope...

How to use ISBLANK function in visuaforce page ?

Hi All, Just a brief what isblank method does. isBlank(inputString) Returns  true  if the specified String is white space, empty (''), or null; otherwise, returns  false . How to render a particular component based on the string value defined in the controller. if that string is null or blank dont rerder component. In the class say the variable name is Public String sStringBlankField{get;set;}   In the visualforce page use it like below  <apex:outputpanel  rendered = "{!len(sStringBlankField)>0 || sStringBlankField!=null}" >  </apex:outputpanel

How to use custom Lebel in javascript file ?

We all know how custom labels are useful, we can use in apex/visual force/workflow formula/validation rule etc. This post is all about hot to use in java script file which is been uploaded in static resource. In the page just add these two lines of code, which will make js file understand the custom label.  <script>        window.$Label = window.$Label || {}; $Label.CUSUTOMLABELNAME = '{!JSENCODE($Label.CUSUTOMLABELNAME )}'; </script> In the java script file use like below alert($Label.CUSUTOMLABELNAME );

How to use includes operator in query filter ?

Hi All, It has been a long time, there is no post in salesforce4u, I am apologizing for being so late, now I am assuring you, there will be at least one post in each month. We will start with the simple one, Last week I faced one query exception " expecting left parentheses, found ': '",  Let me share how did I resolve that issue. The requirement was just filtering records using multi-select picklist values. What exactly will come to a developer mind ??  Use the following operator to accomplish. 1. LIKE - It will be used for normal string/text field filter and it's a partial match. 2. CONTAINS - It is not being used at all in SOQL 3. INCLUDES - This is the best one to use for this requirement. How to use INCLUDES operator in the SOQL query. Below is the code snippet to filter Account based on value  (  'Agriculture','HR'  ). Static Querry List<Account> accList = [Select id,name,LOB__c from Account where LOB__c  ...