ads

Thursday, 14 December 2017

Password field on Visualforce Page In Salesforce


VF TAG :


<apex:inputSecret value="{!PasswordValue}" id="PasswordValue"/>



VF Page :


<apex:page controller="contClass">
    <apex:form >
       Password : <apex:inputSecret value="{!PasswordValue}" id="PasswordValue"/>
    </apex:form>
</apex:page>


Output Screen :



How to Get parent records which has No(Zero) child Using SOQL In Salesforce


SOQL Explanation :




SELECT Id FROM Account WHERE Id NOT IN (SELECT AccountId FROM Contact)

Get N Character from a string using JAVASCRIPT


Use of CharAt(N)


var TestStr = '12345678';
String s = TestStr.charAt(3); 

//As index Start From 0 It Will Return 4

System.assertEquals()


System.assertEquals()


Public class AssertDemo {
    
    public void NewContact(String LastNameStr, String EmailStr) {
        Contact ConInstance = new Contact(LastName = LastnameStr,Email = EmailStr);
        Insert ConInstance;
        System.assertEquals('SFDCDOTCOM',ConInstance.LastName);
    }
}


 //the lastname of the Contact should be 'SFDCDOTCOM'. If we give the lastname
 // other than 'SFDCDOTCOM', it will throw error.

2FA For Community User In Salesforce (Two Factor Authentication )


Follow below Points Step by Step


1.      From Setup, enter Profiles in the Quick Find box, then select Profiles.





2.    Select a profile. In our case select “Portal_Super_User” profile.


3.   Click on Profile “Portal_Super_User”. Scroll to Session Settings and click on it



4: Click edit and For Session security level required at login, select High Assurance.

5. Click Save.

6: From Setup, enter Session Settings in the Quick Find box, then select Session Settings.



7: You will redirect to below page after clicking Session Setting.



8:  In Session Security Levels, scroll down and make sure that Two-Factor Authentication is in the High Assurance column.

If Two-Factor Authentication is in the Standard column, users get an error when they log in with a method that grants standard-level security.



9: Now try login into community using below URL. (URL may change based on your org.)


10 : You will redirect to below page.



11 :  Insert Username and Password and click login. 


12 : If this is your first time after 2FA enabled for user, you will redirect to below screen and it will
ask you to install the Salesforce Authenticator into your mobile.

You can download Salesforce Authenticator from Play Store.




13 :Once you download the Salesforce Authenticator click on “Add Account” to link your app
      with a salesforce org. You will get a two-word phrase.





14 :  Insert that Two-word phrase in below screen.







15.On connecting you will get notification with details of the user asking you to either “Approve” or “Deny” the login trial.





16: Now every time you will try logging into community you will get below screens asking you to either       “Approve” or “Deny” the login trial.





17 .Finish.

Monday, 11 December 2017

Rich Text Area field In Salesforce


Expected Format :

Load RTE Fields through Data loader or something
o Test 1
o Test 2

We need to provide the Text for Rich Text Area field in HTML format in CSV file.

Format Needed in CSV file :-

<p>Load RTE <font size="3">Fields through</font> Data loader or <b><span style="color: red;">something</span></b><br> o Test 1<br> o Test 2<br> </p>


Detail Page Screenshot :




All Salesforce Cheat Sheet :


1) Salesforce 1 Developer Cheatsheet                          [ Download ]

2) Salesforce 1 Admin Cheatsheet                                [ Download ]

3) App Logic: Process Automation Cheatsheet             [ Download ]

4)  App Logic: Formulas Cheatsheet                              [ Download ]

5)  App Logic: Apex Code Cheatsheet                           [ Download ]

6) UI: Lightning Components Cheatsheet                      [ Download ]

7) UI: Visualforce Cheatsheet                                        [ Download ]

8) Custom Metadata Types Cheatsheet                         [ Download ]

9) Integration: Force.com REST API Cheatsheet          [ Download ]

10)  Integration: SOAP API Cheatsheet                         [ Download ]

11) Reports and Dashboards REST API Cheatsheet     [ Download ]

12) Security for Developers Cheatsheet                         [ Download ]

13) Security for Admins Cheatsheet                               [ Download ]

14)  Query & Search Optimization Cheatsheet               [ Download ]

15) Record Locking Cheatsheet                                     [ Download ]

16) Git Cheatsheet                                                          [ Download ]

17) Service Cloud Cheatsheet                                        [ Download ]

18) CRM Cheatsheet                                                       [ Download ]

19)  CRM Lightning Cheatsheet                                      [ Download ]


Lightning Components Cheat Sheet



Lightning Components Cheat Sheet


Download Link :  Lightning Component Cheat Sheet

Friday, 8 December 2017

Replace function in String using Apex in Salesforce


Explanation :


String OldStr = 'SFDCFORYOUDOTCOM';
String NewStr = OldStr.replace('F','@@@').replace('D', '&&&&');

System.Debug('NewStr====>'+NewStr);


Debug Output :





Convert Integer To String using Apex In salesforce


Explanation :


Integer I1 = 2222;
String TxtStr = String.valueOf(I1);

System.debug('TxtStr=====>'+TxtStr);



Debug Output :-





Concatenate As String Using Apex In Salesforce



Explanation :


Integer I1 = 2222;
Integer I2 = 1111;

String ConcatStr = String.valueOf(I1) + String.valueOf(I2);
System.debug('ConcatStr=====>'+ConcatStr);



Debug Output :


Convert String To Integer Using Apex In Salesforce


Explanation :


String TxtStr='9';    
Integer NoInteg = Integer.ValueOf(TxtStr);
System.debug('NoInteg===>'+NoInteg);r);


Debug Output :


Convert sObject To String Using Apex In Salesforce


Explanation :


public Contact Con = new Contact(LastName = 'New Contact');
String objTypeStr = String.valueOf(Con);
System.debug('objTypeStr===>'+ objTypeStr);


Debug Output :




Get substring of string after particular character using Apex in Salesforce

substringAfter() :Used to find substring of string after particular character using Apex in Salesforce


Explanation :


String txtString = 'Xys@sfdcforyou.com';
String RemStr =  txtString.substringAfter('@');
system.debug('RemStr===>'+RemStr);



Debug Output :



Convert String to Id In saleforce


Explanation :


String StrId = '0012800001VbHZv'; // StrId Should be a Vaild Record Id
Id IdValue = Id.valueOf(StrId);
System.debug('IdValue====>'+idValue);



Debug Output :



Find the length of the String using Apex in Salesforce




Explanation :

String TextStr = 'sfdcforyou.com';
Integer LengthOfString = TextStr.length();
System.debug('LengthOfString====>'+LengthOfString);


Debug Output :


Thursday, 7 December 2017

Get last N digits from a String using Apex in Salesforce


right() : Used to get last n digits from a String using Apex.

Syntax Used :
txtSting.right(n);


Explanation :

String txtString = 'sfdcforyou';
String FinalStr = txtString.right(6);
system.debug('FinalStr ===>'+FinalStr); //Return foryou

Debug Output :