Play Games

Search This Blog

Friday, July 26, 2019

Flames Calculator Just for fun



How to retrieve LWC components from salesforce instance to Visual studio code tool - Salesforce Globe For You

How to retrieve LWC components from salesforce instance to Visual studio code tool

Step 1: Open the vs code editor and open the commands palette by pressing command+shift +P in Mac.
The following screen appears.


Step 2: Type the command :SFDX create project with Manifest and press enter.

It will ask for project alias.give name and then press enter.It will ask for the folder to store in your local directory(in your local machine laptop or system).

Give the folder and then the project creation will be done as shown in the screen below.


Step 3: Press command+shift+P and then type the following command :SFDX Authorize an org and press enter.

It will ask for alias and then it will be redirected the salesforce login page .

Select the salesforce instance from which we need to retrieve LWC components.

Step 4:Under manifest file, click on package.xml file.
Now if you right click on package.xml it will show you the option 'SFDX:Retrieve source in Manifest from Org'

Select that option, all the required files will get retrieved to your source folder.

Now you can go back to LWC folder and observe all required components are retrieved.

Enjoy..

Saturday, July 20, 2019

Salesforce playground where we can write code and test functionality on the GO

Salesforce playground where we can write code and test functionality on the GO

URL :Salesforce PlayGround

Salesforce playground is a place where we can write ,test and practise our coding on the go.

URL of Sample Gallary Salesforce.

URL of Sample Gallary Salesforce.

Sample gallary is a place where all the sample apps are located.We can get the sample codes related to various funtcionalities that we can directly copy and use in our app development.

URL: Sample Gallary

Thursday, July 18, 2019

How to check if the logged in user has access to a group in visualforce page

How to check if the logged in user has access to a group in visualforce page

We can check whether the logged-in user has access to a group or not with the below code

Boolean hasUserAccess = false;
List<GroupMember> lstGroupMember = new List<GroupMember>();
lstGroupMember = [select GroupId,group.name, group.DeveloperName from GroupMember where groupId='00G0o000003nffh' and UserOrGroupId=:userInfo.getUserId()];

 if(lstGroupMember.size() >0) {
            hasUserAccess = true;
 }

where '00G0o000003nffh' is the ID of the public group created.


Example:
Apex Class: LoggedInUserGroupAccessController

public class LoggedInUserGroupAccessController {
    public Boolean hasUserAccess {get;set;}
    public LoggedInUserGroupAccessController() {
        hasUserAccess = false;
        List<GroupMember> lstGroupMember = new List<GroupMember>();
        lstGroupMember = [select GroupId,group.name, group.DeveloperName from GroupMember where groupId='00G0o000003nffh' and UserOrGroupId=:userInfo.getUserId()];
        if(lstGroupMember.size() >0) {
            hasUserAccess = true;
        }
    }
}

Visualforce Page: LoggedInUserAccessInVFPage

<apex:page controller="LoggedInUserGroupAccessController">
  <apex:outputPanel rendered="{!if(hasUserAccess == true,true,false)}">Logged In User has access</apex:outputPanel>
</apex:page>

Output:

Friday, July 12, 2019

How to rename trialhead playground name

How to rename trialhead playground name 
Problem: I want to rename the trial-head playground name so that its easy for me on which trial-head playground i need to work.

Solution:

Step1 : Go the trial-head module and login.

In the dropdown where it displays all trial-heads, select  'Manage my hand-on orgs' value as shown below.


Step2: A page will be displayed as shown in the image below.


Select pencil icon next to trailhead playground which you want to rename and do the change.
once you rename, click save to save the changes.

Thats it.Now you can see the name in the dropdown if you refresh the page.