Webinar: Coding for Salesforce Admins

Friday, August 4, 2017

Coding for Admins!


Read more ...

How to implement Google Map in visualforce page ?

Wednesday, July 19, 2017

Implement Google Map in visualforce page


Following code works for you if you need Google Map in visualforce page,

1. If your visualforce page does not show up with the map then just replace the "<script src="http://maps.google.com/maps?file=api" />" to "<script src="https://maps.google.com/maps?file=api" />".

2. As you can see that I have used standard controller so you need to pass the account Id in URL. Let’s say if the page name is “ImplementGoogleMaps” then the URL will look something like this : “…/apex/ImplementGoogleMaps?id=YOUR_ACCOUNT_ID”.


3. When you click on the balloon(Map marker) it will show you the Account name and the address, you can change it according to your need by changing the code of line "marker.bindInfoWindowHtml"

Reference :
http://code.google.com/apis/maps/documentation/webservices/

Hope it help you out !!

<apex:page standardController="Account">

<script src="http://maps.google.com/maps?file=api" />

<script type="text/javascript">

var map = null;
var geocoder = null;

var address = "{!Account.BillingStreet}, {!Account.BillingPostalCode} {!Account.BillingCity}, {!Account.BillingState}, {!Account.BillingCountry}";

function initialize() {
     if(GBrowserIsCompatible()){
         map = new GMap2(document.getElementById("MyMap"));
         map.addControl(new GMapTypeControl());
         map.addControl(new GLargeMapControl3D());
         geocoder = new GClientGeocoder();
         geocoder.getLatLng(address,
             function(point){
                 if(!point){
                     document.getElementById("MyMap").innerHTML = address + " not found";
                 }else{
                     map.setCenter(point, 13);
                     var marker = new GMarker(point);
                     map.addOverlay(marker);
                     marker.bindInfoWindowHtml("Account Name : <b><i> {!Account.Name} </i></b> Address : "+address);
                 }
             }
         );
     }
}

</script>

<div id="MyMap" style="width:100%;height:300px" />

<script>
    initialize() ;
</script>

</apex:page>
Read more ...

How to display image while switching Field value ?

Monday, October 17, 2016
How to Change Image or display image while switching Value of fields ?


Hi All,

Here i will show you how to display image based on Field value like Account Status = Active / InActive in Visualforce page...


Step 1 : Save your image in Static Resource
Step 2 : Do some code in Visualforce page
Step 3 : Use this code in your Visualforce page to get the exact output


<apex:column headerValue="Status" width="07%">
  <apex:image id="On" value="{!$Resource.On}" rendered="{!IF(pr.Status__c == 'Open',true,false)}"/>
  <apex:image id="Off" value="{!$Resource.Off}" rendered="{!IF(pr.Status__c == 'Closed',true,false)}"/>
</apex:column>



Gray Image is indicating the Account is InActive & Green Image is indicating the Account is Active..


Hope this will helps !! 
Cheers !!
Read more ...

How to Count Number of Records in Related List and Display in Parent object Layout (Using Trigger) ?

Monday, September 19, 2016

How to Count Number of Records in Related List of Parent object and How to Display the Result in Parent Object Field (Using Apex Trigger) ?


Hi Guys,

After a long time i am here to share one post with you..

Here, I am Posting one Code for Counting No. of Records in Related list of Parent object and Display that Result in Custom field of Parent object..

Let's say i am counting here Number of Contact (Child) which is related to one Account (Parent)...

APEX TRIGGER CODE :

trigger countContact on Contact (after insert,after update) {

     Set<String> AccId = new Set<String>();
     
     List<Account> acc= new List<Account>();
     
     //Store the Temporary Account Id of the Child Contact
     for (Contact c1 : Trigger.New) {
        if (c1.AccountId != null) {
            AccId.add(c1.AccountId);
        }
    }
     
     // Functionality to Count Number of Contact available in Related Account
     for(Contact c : Trigger.New){
     
         List<AggregateResult> con =[SELECT AccountId aId, Count(Id)countContact FROM Contact WHERE AccountId IN : AccId GROUP BY AccountId];
         
         Integer contactCount = (Integer)con[0].get('countContact');
         
         System.debug('contact Count is ='+contactCount);
         
         // Store or Display Result of Counting Contact to Account's custom Field in Account Page Layout
         Account a = new Account();
         a.Id = (Id)con[0].get('aId');
         a.Contact_count__c = (Integer)con[0].get('countContact');
         acc.add(a);
         
     }
     
     update acc;
}



Cheers !!!!
Read more ...

Join Salesforce at the Great Indian Developer Summit in Bangalore and Pune!

Wednesday, April 13, 2016

Salesforce Developer Summit in Bangalore and Pune


Hey Guys,

Are you using Salesforce Development then it's good for all of us because "SALESFORCE AT THE GREAT INDIAN DEVELOPER SUMMIT IN BANGALORE & PUNE" scheduled....Woohaa !! 

Salesforce is going to be at the GIDS conference from April 26-29 in Bangalore and April 30 in Pune.....

Join and learn about Salesforce App Cloud from Salesforce experts. 
They will have Force.com and Heroku demos, breakout sessions and hands-on workshops.
Don’t forget to enter the raffles for a chance to win a mega prize.


You will also get the opportunity to build cloud apps in minutes and earn a cool t-shirt or a developer book



SALESFORCE BREAKOUTS AND
HANDS-ON WORKSHOPS
Force.com and Heroku Connect Overview
Operationalize Big Data-As-A-Service
Force.com and Heroku Connect hands-on workshop


Hurry Up.....!!!

Thanks
Read more ...

How to get standard field ID of Standard Object?

Friday, April 8, 2016

List of Standard field Id of Standard Objects


Hi Guys,

I hope all you know How to get Id of custom fields but this post will help you to understand about standard fields Id of Standard Object...

If you want to find your self then right click on your page and select View Source............

Object Name - EVENTS
Field Type
ID
Assigned To
ID
 evt1_lkid
Text
evt1_lkold
Subject
evt5
Who
Picklist
evt2_mlktp
ID
evt2_lkid
Text
evt2
What
Picklist
evt3_mlktp
ID
evt3_lkid
Text
evt3
Private
IsPrivate
Activity Currency
evt9
Location
evt12
Date
evt4
Time
evt13
All Day Event
evt15
Type
evt10
Show Time As
ShowAs
Description
evt6
Object Name - TASKS
Field Type
ID
Assigned To
ID
tsk1_lkid
Text
tsk1
Subject
tsk5
Due Date
tsk4
Status
tsk4
Who
Picklist
tsk2_mlktp
ID
tsk2_lkid
Text
tsk2
What
Picklist
tsk3_mlktp
ID
tsk3_lkid
Text
tsk3
Comments
tsk6
Notify by Email
email
Object Name - CAMPAIGNS
Field Type
ID
Campaign Name
cpn1
Type
cpn2
Status
cpn3
Start Date
cpn5
End Date
cpn6
Expected Revenue
cpn8
Budgeted Cost
cpn9
Actual Cost
cpn10
Expected Response %
cpn11
Campaign Currency
cpn7
Number Sent
cpn13
Active
cpn16
Description
cpn4
Object Name - LEADS
Field Type
ID
Salutation
Picklist
name_salutationlea2
First Name
name_firstlea2
Last Name
name_lastlea2
Company
lea3
Title
lea4
Lead Source
lea5
Industry
lea6
Annual Revenue
lea7
Campaign
ID
lea20_lkid
Text
lea20_lkold
Description
lea17
Phone
lea8
Mobile
lea9
Fax
lea10
Email
lea11
Website
lea12
Lead Status
lea13
Rating
lea14
# of Employees
lea15
Email Opt Out
lea22
Street
lea16street
City
lea16city
State/Province
lea16state
Zip/Postal Code
lea16zip
Country
lea16country
Use Assignment Rule
lea21
Object Name - ACCOUNTS
Field Type
ID
Account Name
acc2
Account Site
acc23
Account Number
acc5
Type
acc6
Industry
acc7
Annual Revenue
acc8
Account Currency
acc24
Rating
acc9
Phone
acc10
Fax
acc11
Website
acc12
Ticker Symbol
acc13
Ownership
acc14
Employees
acc15
SIC Code
acc16
Billing Street
acc17street
Billing City
acc17city
Billing State/Province
acc17state
Billing Zip/Postal Code
acc17zip
Billing Country
acc17country
Shipping Street
acc18street
Shipping City
acc18city
Shipping State/Province
acc18state
Shipping Zip/Postal Code
acc18zip
Shipping Country
acc18country
Description
acc20
Object Name - CONTACTS
Field Type
ID
Salutation
Picklist
name_saluatationcon2
First Name
name_firstcon2
Last Name
name_lastcon2
Account
ID
con4_lkid
text
con4_lkold
Title
con5
Department
con6
Birthdate
con7
Reports To
ID
con8_lkid
Text
con8_lkold
Lead Source
con9
Contact Currency
con21
Phone
con10
Home Phone
con13
Mobile
con12
Other Phone
con14
Fax
con11
Email
con15
Assistant
con16
Asst. Phone
con17
Email Opt Out
con23
Mailing Street
con19street
Mailing City
con19city
Mailing State/Province
con19state
Mailing Zip/Postal Code
con19zip
Mailing Country
con19country
Other Street
con18street
Other City
con18city
Other State/Province
con18state
Other Zip/Postal Code
con18zip
Other Country
con18country
Description
con20
Object Name - OPPORTUNITIES
Field Type
ID
Name
opp3
Account
ID
opp4_lkid
Text
opp4_lkold
Type
opp5
Lead Source
opp6
Forecast Category
ForecastCategory
Opportunity Currency
opp16
Amount
opp7
Close Date
opp9
Next Step
opp10
Stage
opp11
Probability
opp12
Campaign Source
ID
opp17_lkid
Text
opp17_lkold
Description
opp14
CONTRACTS
Field Type
ID
Account
ID
ctrc7_lkid
Text
ctrc7_lkold
Customer Signed By
ID
ctrc16_lkid
Text
ctrc_lkold
Customer Signed Title
CustomerSignedTitle
CustomerSignedTitle
ctrc6
Contract Currency
CurrencyIsoCode
Price Book
ctrc17
Status
ctrc15
Contract Start Date
ctrc5
Contract Terms(months)
ctrc40
Owner Expiration Notice
ctrc13
Company Signed By
ID
CompanySigned_lkid
Text
CompanySigned_lkold
Company Signed Date
CompanySignedDate
Billing Street
ctrc25street
Billing City
ctrc25city
Billing State/Province
ctrc25state
Billing Zip/Postal Code
ctrc25zip
Billing Country
ctrc25country
Special Terms
SpecialTerms
Description
Description
Object Name - CASES
Field Type
ID
Contact
ID
cas3_lkid
Text
cas3_lkold
Type
cas5
Case Reason
cas6
Case Currency
cas24
Status
cas7
Priority
cas8
Case Origin
cas11
Visible in Portal
cas27
Subject
cas14
Internal Comments
Cas15
Assignment Rules
cas21
Send notification to Contact
cas22
Object Name - SOLUTIONS
Field Type
ID
Name
SolutionName
Details
SolutionNote
Object Name - PRODUCTS
Field Type
ID
Name
Name
Product Code
ProductCode
Quantity Scheduling Enabled
CanUseQuantitySchedule
Product Currency
CurrencyIsoCode
Description
Description
Active
IsActive
Product Family
Family
Revenue Scheduling Enabled
CanUseRevenueSchedule
Quantity Schedule Type
pQST
Quantity Installment Period
pQSI
Number Of Quantity Installments
pQSN
Revenue Schedule Type
pRST
Revenue Installment Period
pRSI
Number Of Revenue Installments
pRSN
Object Name - DOCUMENTS
Field Type
ID
Name
Name
Internal Use Only
iuo
Externally Available Image
pub
Folder
pid
Description
desc
Keywords
key
 

Thanks :)
Read more ...