Play Games

Search This Blog

Tuesday, October 17, 2017

Friday, October 13, 2017

How to get all the child objects related to an object in Salesforce

Solution : By using getChildRelationships() ,we can fetch all the child objects associated to an object.
In this example,we fetch all the child objects associated to Account object.
Sample Apex Code:
Set<String> lstObject = new Set<String>();
Schema.DescribeSObjectResult sObjResult = Account.SObjectType.getDescribe();
for(Schema.ChildRelationship cr: sObjResult.getChildRelationships()) {
    lstObject.add(string.valueOf(cr.getChildSObject()));
}
system.debug('Child Objects associated with Account:'+lstObject);
Output: When we run the above code in workbench,output will be like this:


How to get all the parent objects related to an object in Salesforce

Solution : By iterating through all the fields of an object and checking if it has any reference,we can fetch all the parent objects associated to an object.
In this example,we fetch all the parent objects associated to opportunity object.
Sample Apex Code:
Set<String> lstObject = new Set<String>();
for(Schema.SobjectField sField: opportunity.SobjectType.getDescribe().fields.getMap().Values()) {
    if(sField.getDescribe().getType() == Schema.DisplayType.REFERENCE) {
        for(Schema.sObjectType sObj : sField.getDescribe().getReferenceTo()) {
        lstObject.add(string.valueOf(sObj));
        }
    }
}
system.debug('Parent Objects associated with Opportunity:'+lstObject);
Output: When we run the above code in workbench,output will be like this:

Thursday, October 12, 2017

How to capture/take screenshot of entire screen even by scrolling(Full Page Capture)

Google Chrome has provided a plugin 'Fireshot' to capture full page.
Steps:
Step 1: Open the following url Fire Shot or search for Fireshot plugin in chrome browser.
The following screen will be opened.

Step 2: Click on "Add to Chrome" as shown in the image above.
It will open popup as shown below.

Step 3: Click on 'Add Extension' to add the plugin to browser.
Once plugin is added,you will find symbol 's' added on browser on the top right as shown in the image below

Step 4: Click on that icon and click on 'Capture selection' as shown in the image below to capture what ever you select even by scrolling.

Step 5:Thats it..now your screen is captured....



Tuesday, October 3, 2017

How to login to the newly created salesforce Trailhead playground - Salesforce Globe For You

Steps:
Step 1: Follow the steps from 1 to 5 in the following page
http://salesforceglobe4u.blogspot.in/2017/10/how-to-create-trialhead-playground.html
Step 2: Click on the dropdown icon before 'Launch' button and then select your trialhead playground instance.


Step 3: Click on Launch button to launch the instance.
Step 4: After instance is opened,click on Gear symbol as shown in the image below nd select Setup.

Step 5: Enter Users in the Quick Find box, then select Users.
Check the box next to your name and Make note of your username as highlited in the image below.
Step 6: Click Reset Password(s) and then OK.
This sends an email to the address associated with your username. If you don't see the email, check your spam folder.
Click the link in the email.
Step 7: Enter a new password and confirm it.
Thats it.Now you have the username and password for your Trailhead Playground!

How to create trialhead playground instance for trialhead in salesforce

Steps:
Step 1: Go to https://trailhead.salesforce.com/ 
The following screen opens as shown in the image below.

Step 2: Login to trailhead account by clicking on login button as shown in the above image.

Click on 'Login to Salesforce' and enter credentials to login in.
Step 3: After u logged in to existing salesforce trialhead,Go to modules tab and go to any one trialhead topic for example I went to 'Apex Basics and Database' module.
https://trailhead.salesforce.com/modules/apex_database


Step 4: Click on 'Get Started with Apex' hyperlink .It will be redirected to the following screen.

Step 5: Scroll down the screen where you find launch button as shown in the image.

Step 6: Click on the dropdown icon before 'Launch' button as shown in the image above and then click on 'Create a Trialhead playground' as shown in the image below to create a trialhead playground instance.

Thats it.Wait for couple of minutes.The playground instance gets created.Enjoy !!!