Wednesday, 4 April 2018








Thursday, 25 January 2018



Color code for PageBlockSection Title Bar in Salesforce


Below is the code for color coding PageBlockSection title bar

<apex:page >
    <style>
        body .bPageBlock .pbBody .red .pbSubheader{
            background-color:red;
        }
        body .bPageBlock .pbBody .grey .pbSubheader{
            background-color:green;
        }          
    </style>
    <apex:pageBlock > 
   <center><h1> Color code for PageBlockSection Title Bar </h1></center><br/>
        <apex:outputPanel styleClass="red" layout="block">
            <apex:pageBlockSection title="first pbs title" id="pb1">
                first section 
            </apex:pageBlockSection>
        </apex:outputPanel>
        <apex:outputPanel styleClass="grey" layout="block">
            <apex:pageBlockSection title="second pbs title" id="pb2">
                second section
            </apex:pageBlockSection>
        </apex:outputPanel>
    </apex:pageBlock>
</apex:page>

Screen shot:



Hope above info might be helpful :-)

Wednesday, 3 January 2018





What is the difference between the IN and = operator in SOQL Salesforce?




Below is the definition and example for " IN " and " = " operators
 
" : " bind variable for access variable in the query as below

String MyFirstName = 'sampath';
List<Contact> ListOfName = [SELECT FirstName FROM Contact WHERE FirstName =  : MyFirstName];


" = " operator is simple Equal operator in the query as below

List<Contact> ListOfName = [SELECT FirstName FROM Contact WHERE FirstName =  'sampath'];
Note :- gets list of contacts where firstName = sampath (equals to sampath)


" IN " operator in soql for refer LIST or SET direct in the query as below

List<String> lstOfStr = new List<String>{'Sai','Sampath'};
List<Contact> ListOfName = [SELECT FirstName FROM Contact WHERE FirstName IN : lstOfStr];
Note :- here also we use bind ":" operator for access variable value in soql query.



Hope above info might be helpful, thank you :-)

Sunday, 30 April 2017

Difference between "style.visibility" and "style.display" 

Basically there are different ways for displaying and hiding data through javascript in which "style.visibility and style.display " are two ways to hide and display data.

Below are the properties used for hide and display 

visibility property
visible - The element is visible. This is default
hidden - The element is not visible, but still affects layout

display property
block - Element is rendered as a block-level element
none - Element will not be displayed
style.display:


Basic Difference between 

style.display:
1. display:none will not be available in the page and does not occupy any space. 
2. display:none doesn't preserve the space

style.visibility:
1. visibility:hidden hides an element, but it will still take up the same space as before. The element         will be hidden, but still affect the layout. 
2. visibility:hidden preserve the space

Below example will give clear view for display and visibility

In this example I have a pick-list called type and values "First" and "Second" and two more sections 
"First Section" and "Second Section". So what i am going to do is hiding sections based on the selected picklist value.

Initial screen:(before adding code for hiding )

Code for Style.visibility
<apex:page standardController="account">
    <script>
        function hidesection(x)
        {
            var typevalue = x.value;
            if(typevalue == 'First' )
            {
                 document.getElementById('firstsec').style.visibility = 'visible';
                 document.getElementById('secondsec').style.visibility = 'hidden';
            }else if(typevalue == 'Second')
            {
                 document.getElementById('firstsec').style.visibility = 'hidden';
                 document.getElementById('secondsec').style.visibility = 'visible';
            }else
            {
                 document.getElementById('firstsec').style.visibility = 'hidden';
                 document.getElementById('secondsec').style.visibility = 'hidden';
            }
        }
    </script>
    <apex:form >
        Type   <apex:inputField value="{!account.type}"   onchange="hidesection(this);"  />
       <div id="firstsec" style="visibility:hidden;">
           First Section
       </div>
       <div id="secondsec" style="visibility:hidden;">
           Second Section
       </div>
   </apex:form>
</apex:page>
Onpage Load :

When you select pickval as First then "Second section" will be hidden:

When you select pickval as Second then "First Section" will be hidden but you can see there is an empty line in the "first section" place

Code for Style.display
<apex:page standardController="account">
    <script>
        function hidesection(x)
        {
            var typevalue = x.value;
           
            if(typevalue == 'First' )
            {
                 document.getElementById('firstsec').style.display= 'block';
                 document.getElementById('secondsec').style.display= 'none';
            }else if(typevalue == 'Second')
            {
                 document.getElementById('firstsec').style.display= 'none';
                 document.getElementById('secondsec').style.display= 'block';
            }else
            {
                 document.getElementById('firstsec').style.display= 'none';
                 document.getElementById('secondsec').style.display= 'none';
            }
        }
    </script>
    <apex:form >
        Type   <apex:inputField value="{!account.type}"  onchange="hidesection(this);"  />
       <div id="firstsec" style="display:none;">
           First Section
       </div>
       <div id="secondsec" style="display:none;">
           Second Section
       </div>
   </apex:form>
</apex:page> 


Onpage Load :


When you select pickval as First then "Second section" will be hidden:


When you select pickval as Second then "First Section" will be hidden but you can see "second section" will be displayed in the First line itself and there will be no empty line in the "first section" place.


Hope this is helpful for you  :-)


Wednesday, 15 February 2017


Want to download and view Salesforce certificate ?


For viewing and downloading all salesforce related certificates please click below link and enter registered email id for exam or Full Name


Wednesday, 1 February 2017





Display Section Based on selected picklist value in visualforce salesforce


if you want to display and hide section based on picklist value ? then check the below code

<apex:page standardController="lead" id="pg1">
    <script>
        function hidesection()
        {
           var a = document.getElementById('{!$Component.pg1.form1.status1}').value;
         
           if(a=='Re Scheduling')
           {
               document.getElementById('section1').style.display='none';
           }else
           {
                document.getElementById('section1').style.display='block';
           }
        }
    </script>
    <apex:form id="form1">
        <label><b>Status</b></label>
        <apex:inputField id="status1" onchange="hidesection();"  value="{!lead.status}"/><br/>
        <div id="section1">
            Section 1 will hide when status is pending
        </div><br/>
        <div id="section2">
            Section 2 will not change
        </div>
    </apex:form>
 
</apex:page>

The above will hide the div section1 when ever status is changed to "Re Scheduling"

Output(initial screen on page load)



Output(after selecting picklist value as "Re Scheduling")


Tools for Lightning Web Component Development

 Below are the tools required for Web Component Development 1. Chrome Browser (Prefered) You can download it from Google 2. Visual Studio Co...