Author Archive nayakdillip

Bynayakdillip

Platform Developer I Certification Maintenance (Winter ’19)

Q-1 Which method of the DescribeSObjectResult class allows you to access record types by their developer name? ANS:
getRecordTypeInfosByDeveloperName()

Q-2 Which Apex class includes new methods to verify digital and HMAC signatures? ANS:- System.Crypto

Q-3 Your org has My Domain enabled. What is the most efficient method to obtain a valid session ID to make an HTTP callout from asynchronous Apex code to Salesforce APIs? ANS:-
Use System.UserInfo.getSessionId().

Q-4Which annotation allows a developer to make the result of an Apex method storable for Lightning components?ANS:-
@AuraEnabled(cacheable=true)

Q-5:Which merge field allows you to isolate untrusted third-party content with <apex:iframe> tag in Visualforce?ANS:-
$Page.IFrameResource

Q-5: Prior to installing an unlocked package, which object should a developer query using the Tooling API to list the packages it depends on? ANS:- SubscriberPackageVersion

TowerMapUtilClass
public inherited sharing class TowerMapUtilClass {
     public static List queryObjects(String theObject, List theFields, String theFilter, String sortField, String sortOrder) {
          String theQuery = 'SELECT ' + string.join(theFields, ',');
          theQuery += ' FROM ' + theObject;
          if(!String.isEmpty(theFilter)) {
               theQuery += ' WHERE ' + theFilter;
          }
          if(!String.isEmpty(sortField)) {
               theQuery += ' ORDER BY ' + sortField;
               if(!String.isEmpty(sortOrder)) {
                    theQuery += ' ' + sortOrder;
               }
          }
          return database.query(theQuery);
     }
}
TowerMapControllerClass.apxc
public inherited sharing class TowerMapControllerClass {
     @AuraEnabled
     public static List getAllTowers() {
          String theObject = 'Tower__c';
          List theFields = new List{'Id', 'Name', 'State__r.Name', 'Tower_Location__Latitude__s', 'Tower_Location__Longitude__s'};
          String theFilter = '';
          String sortField = 'Name';
          String sortOrder = 'ASC';
          List allTowers = TowerMapUtilClass.queryObjects(theObject, theFields, theFilter, sortField, sortOrder);
          return allTowers;
     }
}
Add below code Towermap.cmp

  <lightning:map 
        mapMarkers="{! v.mapMarkers }"
        markersTitle = "{!v.markersTitle}"
        zoomLevel="5" />

Bynayakdillip

Write a trigger after update on account object

trigger AccountTrigger on Account (after insert,before insert,after update) {
if(Trigger.IsAfter && Trigger.IsUpdate){
set accountSetID=new set();
for(Account AccountDetail:Trigger.new){
system.debug('Account Name'+AccountDetail.Name);
system.debug('AccountDetail.id'+AccountDetail.id);
accountSetID.add(AccountDetail.id);//Store ALl Account ID in Set
}
system.debug('accountSetID'+accountSetID.size());
List contactList=[SELECT LastName,FirstName FROM Contact WHERE ACCOUNTID=:accountSetID];//All Contacts
for(Contact ContactDetail:contactList){
ContactDetail.FirstName='IBM'+ ContactDetail.FirstName;
}
system.debug('contactList'+contactList.size());
system.debug('Contact Name'+contactList[0].FirstName);
update contactList;
}

}

Bynayakdillip

Write Trigger for before Insert on account object

trigger AccountTrigger on Account (after insert,before insert,after update) {
If(Trigger.IsBefore){
for(Account AccountDetail:Trigger.New){
If(AccountDetail.Type=='Prospect'){
AccountDetail.AnnualRevenue=5;//Update AnnualRevenue
}
}
}
Bynayakdillip

Create a validation rule to check that a contact is in the zip code of its account

AND( 
NOT(ISBLANK(AccountId)), 
MailingPostalCode <> Account.ShippingPostalCode 
)

Bynayakdillip

Administrator Certification Maintenance (Winter ’19)

  • On which object can users assign a new owner to multiple records at one time from a Lightning Experience list view? ANS: Lead
  • How can a user place the cursor in the list view search field without navigating to it with the tab button or the cursor? ANS:
    Keyboard shortcut g+f
  • Which Forecast Type should the System Administrator configure to make territory forecasts available to the sales team?ANS:
    Opportunity Revenue by Territory
  • How many decimal places can the user choose to display when creating a dashboard component?ANS:
    Up to 5
  • What will display in the search results when a user uses the quick search on the reports tab?ANS:
    The reports or folders displayed are based on what is selected on the side menu
  • What has to be enabled to allow users to save Chatter posts before they appear in the feed?ANS: Allow draft posts.
  • How can a standard user adjust the page layout to display more fields in the same amount of space?ANS: Change the density from comfy to compact.
  • The customer community manager wants to gamify the community by recognizing members’ specific accomplishments. What can the System Administrator configure to accomplish this goal?ANS:Recognition Badges

Bynayakdillip

How to Reverse an Array

The reverse() method reverses the elements in an array.
Syntax:arrayName.reverse()

Example:-

var programming = ["c#", "c","java","apex"];
var programmingReverseOrder = programming.reverse();
alert(programmingReverseOrder);

it will be print like
apex,java,c,c#

Bynayakdillip

How to join or combine two arrays to one array?

JavaScript Array concat() Method

it returns combine of records from two arrays.

Example:-

var programming = ["c#", "c","java","apex"];
var dataBaseRelated = ["SQL", "SOQL", "MySQL"];
var application = programming.concat(dataBaseRelated);
alert(application);

It will print like this
c#,c,java,apex,SQL,SOQL,MySQL

Bynayakdillip

How to get size of items in an array?

JavaScript Array length Property
length:it returns size(no.of items ) of an array

Example:-

var languageArray=['c#','c','java'];
//its diplay like c#,c,java
alert(languageArray);

//remove last item using pop method
var arraylength=languageArray.length;
alert(arraylength);

//it will print 3(no of items in languageArray is 3)

Bynayakdillip

How to remove last item to an array?

JavaScript Array Pop() Method

Pop(): it helps to remove last item(element) from an array and returns the final array.

Example:-

var languageArray=['c#','c','java'];
//its diplay like c#,c,java
alert(languageArray);

//remove last item using pop method
languageArray.pop();
alert(languageArray);

//it will print c#,c,java

Bynayakdillip

How to append item to an array?

JavaScript Array push() Method

Push():-Its helps to add a new item at the end of the array.use the push() method/function to append an array

Example:-

//Array of programing language
var languageArray=['c#','c','java'];
//its diplay like c#,c,java
alert(languageArray);

//Append new value to the array

languageArray.push('salesforce');

alert(languageArray);

//it will print c,c#,java,Salesforce

Note: You also push object type in an array its depend upon your requirement.