Decoding Salesforce

Decoding Salesforce

The hows and whys of Salesforce.com

Posts Tagged ‘URLs’

How to obtain a field ID

Often people ask me how to get fields IDs in order to build their custom links. I thought it would have been helpful to write a post about this. Let’s see how to get a field ID for custom and standard fields.

Custom Fields

In order to get the ID of a custom field proceed this way:

  • Click on Setup, then on Customize, select the Object you desire (e.g.: Leads) and click on Fields;
  • Click on the name of the custom field you previously created
  • Look at your browser’s address bar, you’ll see something like:
    https://emea.salesforce.com/00N20000000thpj
  • The 15 digit code that appears immediately after https://emea.salesforce.com/ is the ID of that custom field; in this case the ID of the custom field I selected is 00N20000000thpj

Easy enough, isnt’t it :)

Standard Fields

Salesforce.com provides a list of the field’s name for its standard fields, which can be found attached to the solution “How do I create custom links?” and that I decided to paste here as a quick reference:

EVENTSField TypeID
Assigned ToIDevt1_lkid
Textevt1_lkold
Subjectevt5
WhoPicklistevt2_mlktp
IDevt2_lkid
Textevt2

WhatPicklistevt3_mlktp
IDevt3_lkid
Textevt3
PrivateIsPrivate
Activity Currencyevt9
Locationevt12
Dateevt4

Timeevt13
All Day Eventevt15
Typeevt10
Show Time AsShowAs
Descriptionevt6
TASKSField TypeID
Assigned ToIDtsk1_lkid
Texttsk1
Subjecttsk5
Due Datetsk4
Statustsk4
WhoPicklisttsk2_mlktp
IDtsk2_lkid

Texttsk2
WhatPicklisttsk3_mlktp
IDtsk3_lkid
Texttsk3
Commentstsk6
Notify by Emailemail
CAMPAIGNSField TypeID
Campaign Namecpn1
Typecpn2
Statuscpn3
Start Datecpn5
End Datecpn6
Expected Revenuecpn8

Budgeted Costcpn9
Actual Costcpn10
Expected Response %cpn11
Campaign Currencycpn7
Number Sentcpn13
Activecpn16
Descriptioncpn4

LEADSField TypeID
SalutationPicklistname_salutationlea2
First Namename_firstlea2
Last Namename_lastlea2
Companylea3
Titlelea4

Lead Sourcelea5
Industrylea6
Annual Revenuelea7
CampaignIDlea20_lkid
Textlea20_lkold
Descriptionlea17
Phonelea8

Mobilelea9
Faxlea10
Emaillea11
Websitelea12
Lead Statuslea13
Ratinglea14
# of Employeeslea15

Email Opt Outlea22
Streetlea16street
Citylea16city
State/Provincelea16state
Zip/Postal Codelea16zip
Countrylea16country
Use Assignment Rulelea21

ACCOUNTSField TypeID
Account Nameacc2
Account Siteacc23
Account Numberacc5
Typeacc6
Industryacc7

Annual Revenueacc8
Account Currencyacc24
Ratingacc9
Phoneacc10
Faxacc11
Websiteacc12
Ticker Symbolacc13

Ownershipacc14
Employeesacc15
SIC Codeacc16
Billing Streetacc17street
Billing Cityacc17city
Billing State/Provinceacc17state
Billing Zip/Postal Codeacc17zip

Billing Countryacc17country
Shipping Streetacc18street
Shipping Cityacc18city
Shipping State/Provinceacc18state
Shipping Zip/Postal Codeacc18zip
Shipping Countryacc18country
Descriptionacc20

CONTACTSField TypeID
SalutationPicklistname_saluatationcon2
First Namename_firstcon2
Last Namename_lastcon2
AccountIDcon4_lkid
textcon4_lkold

Titlecon5
Departmentcon6
Birthdatecon7
Reports ToIDcon8_lkid
Textcon8_lkold
Lead Sourcecon9
Contact Currencycon21

Phonecon10
Home Phonecon13
Mobilecon12
Other Phonecon14
Faxcon11
Emailcon15
Assistantcon16

Asst. Phonecon17
Email Opt Outcon23
Mailing Streetcon19street
Mailing Citycon19city
Mailing State/Provincecon19state
Mailing Zip/Postal Codecon19zip
Mailing Countrycon19country

Other Streetcon18street
Other Citycon18city
Other State/Provincecon18state
Other Zip/Postal Codecon18zip
Other Countrycon18country
Descriptioncon20
OPPORTUNITIESField TypeID
Nameopp3
AccountIDopp4_lkid
Textopp4_lkold
Typeopp5
Lead Sourceopp6
Forecast CategoryForecastCategory

Opportunity Currencyopp16
Amountopp7
Close Dateopp9
Next Stepopp10
Stageopp11
Probabilityopp12
Campaign SourceIDopp17_lkid

Textopp17_lkold
Descriptionopp14
CONTRACTSField TypeID
AccountIDctrc7_lkid
Textctrc7_lkold
Customer Signed ByIDctrc16_lkid
Textctrc_lkold
Customer Signed TitleCustomerSignedTitle
CustomerSignedTitlectrc6
Contract CurrencyCurrencyIsoCode
Price Bookctrc17

Statusctrc15
Contract Start Datectrc5
Contract Terms(months)ctrc40
Owner Expiration Noticectrc13
Company Signed ByIDCompanySigned_lkid
TextCompanySigned_lkold
Company Signed DateCompanySignedDate

Billing Streetctrc25street
Billing Cityctrc25city
Billing State/Provincectrc25state
Billing Zip/Postal Codectrc25zip
Billing Countryctrc25country
Special TermsSpecialTerms
DescriptionDescription

CASESField TypeID
ContactIDcas3_lkid
Textcas3_lkold
Typecas5
Case Reasoncas6
Case Currencycas24

Statuscas7
Prioritycas8
Case Origincas11
Visible in Portalcas27
Subjectcas14
Internal CommentsCas15
Assignment Rulescas21

Send notification to Contactcas22
SOLUTIONSField TypeID
NameSolutionName
DetailsSolutionNote
PRODUCTSField TypeID
NameName
Product CodeProductCode
Quantity Scheduling EnabledCanUseQuantitySchedule
Product CurrencyCurrencyIsoCode
DescriptionDescription
ActiveIsActive
Product FamilyFamily

Revenue Scheduling EnabledCanUseRevenueSchedule
Quantity Schedule TypepQST
Quantity Installment PeriodpQSI
Number Of Quantity InstallmentspQSN
Revenue Schedule TypepRST
Revenue Installment PeriodpRSI
Number Of Revenue InstallmentspRSN

DOCUMENTSField TypeID
NameName
Internal Use Onlyiuo
Externally Available Imagepub
Folderpid
Descriptiondesc

Keywordskey

Questions? ;)

Play with Custom Links: Part 2

In my last post I explained how to build a simple web custom link; more complex custom links can be used to pass data from your Salesforce records, user information, or company information to another website or application; it can also be used to pass variables from one Salesforce object to another.

Let’s see how to create a custom link to pass fields values from a Salesforce object to another.

Scenario

We give support to different companies and accordingly to what kind of support type a company has, their cases have to be handled differently. We’ve created a custom field for the Account object called Support Type, of type Picklist, containing the variables: “Silver, Gold, Platinum“; we created the same Support Type field for the Case object, same type, same picklist values. We now need to create a custom link in the Account object so when we click on it, we get redirected to a Case page where Account Name and Support Type are filled accordingly to the values present on the Account record.

How to proceed – a step by step guide

First of all we need to find out where in the Case record page our values are going to be “written” to; we basically need to find out the ID of the HTML INPUT fields: Support Type and Account Name.

UPDATE: In order to find a field’s ID please check this post :D

Let’s now move to: Setup > App Setup > Customize > Accounts > Buttons and Links, click on the New button, specify a Label (eg: “New Case”), the Name will be filled in automatically, select the Display Type, the Behavior, make sure the Content Source is URL.

We’re now about to start writing our custom link; the last thing we need is the Object’s code for the Case object: 500 (where did I get this from? Did you read all the old posts? ;) ).

  1. Our custom link will start with: /500/e? which points to the edit page of a new case record.
  2. Now we can pass the variables: cas4, the ID of the Account Name INPUT field in the Case object, will have to contain the actual account name, so we can write cas4= and select Account Name from the Insert Field drop-down list. This will automatically insert {!Account.Name}.

    So far we have:

    /500/e?cas4={!Account.Name}
  3. We have to add an & (ampersand) within the variables.
  4. 00N20000000thpg, the ID of the Support Type INPUT field in the Case object, will need to contain the value of the selected account’s Support Type field, so we can write 00N20000000thpg= and select Support Type from the Insert Field drop-down list. This will automatically insert {!Account.SupportType__c} in the textarea. So far we have:
    /500/e?cas4={!Account.Name}&00N20000000thpg={!Account.SupportType__c}
  5. Doesn’t it look good? :) And it’s almost complete. We can add a retURL to point the user back to the account’s page when the case is saved. Just add retURL=/{!Account.Id} and we’re done! All together!:
    /500/e?retURL=/{!Account.Id}&cas4={!Account.Name}&00N20000000thpg={!Account.SupportType__c}

This should give you an idea of how a custom link works. I hope I’ve been clear enough, if you have any question, just add a comment. :)

Salesforce’s URL Structure

UPDATE: Public apologies to Mike Schinkel, this post was inspired by Mike’s “URL Structure“. I decided to write a similar post to include the full list of known instances, mine wasn’t certainly a way to get credit for something you wrote first Mike! Sorry! :)

Finally found the structure to delete a record in SF, adding it below. Eoin

Here’s a quick introduction to understand the structure of all the URLs in Salesforce:

Instances

Salesforce’s organizations reside on multiple instances, to find out what instance you’re on, once you logged into Salesforce, have a look at the address bar; you’ll notice the URL starts with something like:

ssl – North America #0 (aka na0)
na1 – North America #1
na2 – North America #2
na3 – North America #3
na4 – North America #4
na5 – North America #5
emea – Europe, Middle East, Africa
ap – Asia, Pacific
tapp0 – Sandbox #0
tapp1 – Sandbox #1

https://xyz.salesforce.com

where xyz is the name of the instance your organization is on.

Objects’ specific URLs

Every Salesforce’s object has it’s specific URL, here are listed the links to the standard objects:

ObjectsURLsObjects’ code
Accountshttps://[instance].salesforce.com/001/o001
Contactshttps://[instance].salesforce.com/003/o003
Leadshttps://[instance].salesforce.com/00Q/o00Q
Caseshttps://[instance].salesforce.com/500/o500
Solutionshttps://[instance].salesforce.com/501/o501
Reportshttps://[instance].salesforce.com/00O/o00O
Opportunitieshttps://[instance].salesforce.com/006/o006
Campaignshttps://[instance].salesforce.com/701/o701
Productshttps://[instance].salesforce.com/01t/o01t

Basic action URLs

Use the following URLs to perform the listed operations on a specific object. Note this is fundamental to then understand how to create internal custom links.

Object’s overview page
https://[instance].salesforce.com/[object]/o
ie: https://emea.salesforce.com/500/o

Create a new record
https://[instance].salesforce.com/[object]/e?retURL=/[object_code]/o
ie: https://emea.salesforce.com/500/e?retURL=/500/o

Edit a record
https://[instance].salesforce.com/[object]/[recordID]/e?retURL=[recordID]
ie: https://emea.salesforce.com/50020000000chRD/e?retURL=/50020000000chRD

Clone a record
https://[instance].salesforce.com/[object]/[recordID]/e?retURL=[recordID]&clone=1

Delete a record
https://[instance].salesforce.com/setup/own/deleteredirect.jsp?delID=[recordID]

where:

  • [instance] is the instance’s name your organization resides on;
  • [object] is the object’s code;
  • [recordID] is the ID of the record itself.