Posts

Salesforce Spring 16 Release Exam (Maintenance Exam Q&A) for Developer 401

1 ) What is true about the file sharing “Set by Record?” A) It is used to infer sharing via the record type. B) It is used to infer sharing via the record owner. C) It is used to infer sharing via the parent record. D) It is used to infer sharing via the associated record. 2) Which Quick Actions can contain a “Custom Success Message?” Choose 2 answers A) Send an Email B)Visit a website C)Log a Call D)Update a Record 3) What is true about dataloader? Choose 3 answers A) It can be used with OAuth Authentication B) It can be used with Password Authentication C) It can be used with both Mac and PC . D) It can be used with only a PC. E)It can be used with SAML Authentication. 4) Which standard field can be updated using formal rules in process builder? A) Owner Id B) Deleted C) Created Date D) Id 5) What must be true when accessing a user’s private reports and dashboards? Choose 2 answers A) Having the “Administrator Access to Private Files” permission...

Parse XML using APEX

string  xmlstring =  '<?xml version="1.0" encoding="UTF-8"?><OTPResp status="1" ts="2016-06-09T17:24:46" txn="20160609172112021" resCode="ad3198bda02e3742571c855b50c576de2e8c8641" errCode="" errMsg=""></OTPResp>';                                     DOM.Document xmlDOC = new DOM.Document();                    xmlDOC.load(xmlstring);                    DOM.XMLNode rootElement = xmlDOC.getRootElement();                    //outxmlstring=String.valueof(xmlDOC.getRootElement().getChildAttribute());                     outxmlstring=String.valueof(rootElement.getAttributeValue('status',null));                     outxm...

Calculate the Column values at visual force page

Requirement: Calculate total quantity on visualforce page Solution:  <apex:page>   <form>  <apex:variable var="countqu" value="{!0}"/>   <apex:repeat var="count" value="{!lst}" >  <td > <apex:variable var="countqu" value="{!(countqu + round(count.quantity__c,0 ))}"/> <apex:outputtext value="{!round(count.quantity__c,0 )}" /> </td>   </apex:repeat   >   <td>{!countqu} </td> </form> </apex:page> OUT PUT : Quantity  10 20 30 40 ---------- 100 ( calculate on vf Page) --------

Fetch Custom Setting Value in Apex

    Requirement : Disable the Apex trigger using custom setting: Solution : Create Custom setting:  SetUp>> Custom Setting >> New  Create Custom setting and create a check Box field with name On_Off__c  public class ClassName  {     public void onAfterUpdate(list<SOBJECT> triggerNew, map<id,SOBJECT> triggerNewMap, map<id,SOBJECT> triggerOldMap)     { // Write the Custom setting if On_Off__c = true then trigger method will be excute List<CustomSetting__C>  cstriggerOnOff = CustomSetting__C.getall().values(); if(cstriggerOnOff != null && cstriggerOnOff .size()>0){ if(cstriggerOnOff [0].On_Off__c == true) { MethodName(triggerNew, triggerNewMap, triggerOldMap); } }           }          private void MethodName(list<SOBJECT> triggerNew,map<id,SOBJECT> triggerNewMap,map<id,SOBJECT> ...

Search Contact Records Using Pagination in apex

Image
Requirement : Create a visual force page create a TextBox for Last Name and another is Mobile Phone when User enter the value then corresponding data should be visible in a table Solution: VFPageCode <apex:page controller="ContactMultipleSearchWithPagenationCLS" action="{!searchcon}">      <script type="text/javascript">         window.onload=function() {         // document.getElementById("{!$Component.thePb.thepbs.conName}").focus();         }        </script>      <apex:form >         <apex:pageBlock id="thePb" title="Contact Details To Search">             <apex:pageblockSection id="thepbs">                 <apex:inputField value="{!con.LastName}" required="false" id="conName"/>         ...

Open related list record on Custom Button Click on Parent Detail Page

Image
Requirement: Open All attachment record on a single button click means that , On Detail page of account there is custom button when click on this custom button open all attachment under the account Solution: Create a Custom Button on Account Level call a javaScript as mention below {!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")}  {!REQUIRESCRIPT("/soap/ajax/24.0/apex.js")}  var query = "SELECT Id, ParentId FROM Attachment WHERE ParentId = '{!Account.Id}'";  var records = sforce.connection.query(query);  var records1 = records.getArray('records');  //alert(records);  if(records1.length>0){  //alert(records1.length);  for(var i=0;i<records1.length;i++){  //alert('Test'+ records1[i].Id);  window.open('/servlet/servlet.FileDownload?file='+records1[i].Id);  }  } Step 1 Create  a custom Button on Account Level and write the JavaScript code as mention above refer the screenshot ...

Some Useful Formula Fields

1) Get Week Day CASE(  MOD( DATEVALUE( CreatedDate ) - DATE( 1990, 1, 7 ), 7 ),  0, "Sunday",  1, "Monday",  2, "Tuesday",  3, "Wednesday",  4, "Thursday",  5, "Friday",  "Saturday"  ) 2) Get Month Year Based on PickList Values if(  ispickval(Status__c,'THIS_MONTH'),  (case(Month(Date__c),  1,"JAN",  2,"FEB",  3,"MARCH",  4,"APRIL",  5,"MAY",  6,"JUNE",  7,"JULY",  8,"AUG",  9,"SEP",  10,"OCT",  11,"NOV",  12,"DEC", " "  ) +'-'+ TEXT(year(Date__c))) ,  if(ispickval(Status__c,'NEXT_MONTH'),  (case(Month(Date__c) + 1 ,  1,"JAN",  2,"FEB",  3,"MARCH",  4,"APRIL",  5,"MAY",  6,"JUNE",  7,"JULY",  8,"AUG",  9,"SEP",  10,"OCT",...

Deleted Selected multiple Row from Releated list using custom button

Image
Create a Custom button as a List Type Button and Execute JavaScript Code {!REQUIRESCRIPT('/soap/ajax/29.0/connection.js')} try {   var selectedRecords = {!GETRECORDIDS( $ObjectType.QuoteLineItem )};   if(selectedRecords.length < 1)     alert('Please Select at Least One Row !');   else   {     userConsent = confirm(selectedRecords.length + ' Record(s) will be Deleted. Continue ? ');     if(userConsent == true)     {       delResult = sforce.connection.deleteIds(selectedRecords);              var message = '';       var msgFailedReason = '<br/><h3>Failed Record(s)</h3><br/><div style="height: 300px;overflow-y: scroll;"><table style="border-collapse: collapse;">';       var passCount = 0, failCount = 0;       for(var i=0; i < delResult.length; i++){       ...

Add and Delete Row functionality using wrapper class

Image
Page Code <apex:page controller="AddandDeleteController">     <apex:form >             <apex:pageBlock title="Account Records">         <apex:pageMessages ></apex:pageMessages>             <apex:pageBlockButtons location="top">                 <apex:commandButton value="Add Row" action="{!addRow}" reRender="table" immediate="true"/>             </apex:pageBlockButtons>                 <apex:pageBlockTable value="{!accountwrapperList}" var="page" id="table">                      <apex:column headerValue="Name">                         <apex:inputField value="{!page.account.name}"/>   ...

Open Pop Up Box without using CSS

Image
Page Code <apex:page id="pg" controller="PopupScreenController">     <apex:form id="frm">         <apex:pageBlock title="PopUp" id="pb">             <apex:pagemessages id="msg"/>             <apex:commandButton value="Show Screen" onclick="opnePopup();" Oncomplete="refresh"/>                              <script type="text/javascript">                     var PopupBox;                     var strreason;                     var strcomment;                     PopupBox  = new SimpleDialog("test",false);                     Pop...