Another Salesforce blog!!!

Salesforce, Apex

March, 2017

adding SSH key using puTTY

Watch this video that explains how to generate SSH key for GitLAB or GitHUB or Bitbucket…    

Loading message using

  <apex:commabndButton value=”search” action=”{!doSearch}” reRender=”out” status=”mystatus” /> <apex:outputPanel id=”out”> <apex:actionStatus id=”mystatus”> <apex:facet name=”start”> <apex:outputText value=”loading… please wait!”</apex:outputText> </apex:facet> <apex:facet name=”stop”> <!–show the pageblock or etc… –> </apex:facet>   if you want to display the image you can do that instead of <apex:image value=”{!$Resource.loading}”</apex:outputText>

find the object name by passing id

Id myId = ‘a0141000007TF4D’; system.debug(myId.getSobjectType().getDescribe().getName());

apex:actionFunction javascript

  <apex:actionFunction name=”clearFormFn” action=”{!clearForm}” status=”overlayStatus” rerender=”{!$Component.myForm}” /> <apex:actionStatus id=”overlayStatus” onstart=”showOverlay();” onstop=”hideOverlay();”/> public void clearForm() { //more code here…. } <div id=”overlay”></div> <script type=”text/javascript”> Sfdc.onReady(function() { SfdcApp && SfdcApp.Visualforce && SfdcApp.Visualforce.VSManager && SfdcApp.Visualforce.VSManager.vfPrepareForms([“myPage:myForm”]); }); </script> <script type=”text/javascript”> //——————————— // Function to display overlay div //——————————— function showOverlay() { var o = document.getElementById(‘overlay’); o.style.visibility = ‘visible’; //create […]

!= null or !isEmpty() ?

Is this in regards to String? If so, I usually use String.isBlank( stringToCheck ). This checks for null, empty and all whitespace. If this is in regards to collections, you might have to check both: if ( myList != null && !myList.isEmpty() ) … If you know that your collection is not null (because you […]

INTEGRATION using SOAP API

Enterprise WSDL A strongly typed WSDL for customers who want to build an integration with their salesforce.com organization only. Generate Enterprise WSDL Partner WSDL A loosely typed WSDL for customers, partners, and ISVs who are building client applications for multiple organizations. It can be used to access data within any organization. Generate Partner WSDL Source […]

Invoking HTTP Callouts – GET

I will be using this endpoint link as a test purpose its very simple nothing fancy but the point is to prove how to get connected to this end-point and get access to the data. Step one: Add to the Remote site setting in the Salesforce as shown below. Step two: Create Custom Labels and […]

calling visualforce page from weblink

if(“{!myobject__c.OwnerId}” == “{!$User.Id}”){ window.parent.location.href=’/apex/mypage?id={!myobject__c.Id}’; }else{ alert(“{!$Label.labelalertmessage}”); }

overriding standard page

<apex:page standardController=”name_of_the_object__c” id=”gp”> <apex:detail subject=”{!name_of_the_object__c.Id}” relatedList=”true” inlineEdit=”true” id=”detailgp”/> <apex:includeScript value=”{!$Resource.JQuery}”/> <script> var j$ = jQuery.noConflict(); j$(“iframe”).each(function(){ j$(this).load(function() { j$(this).height( j$(this).contents().find(“body”).height() ); }); }); </script> </apex:page>

apexpage message utility

public static PageReference showMessage(String message, String msgType) { ApexPages.Message msg; if(msgType == ‘Error’) { msg = new ApexPages.Message(ApexPages.Severity.ERROR, message); //error } else{ msg = new ApexPages.Message(ApexPages.Severity.INFO, message); //info } ApexPages.addMessage(msg); return null; } To use: <apex:pageMessages ></apex:pageMessages> showMessage(‘At least ‘ + count + ‘ responses required’, ‘Error’);

Previous Posts