Decoding Salesforce

Decoding Salesforce

The hows and whys of Salesforce.com

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? ;)

If you liked this post, buy me a beer! 3EUR, securely via PayPal

22 Responses to “How to obtain a field ID”

  1. Chris says:

    I love you guys.

  2. [...] UPDATE: In order to find a field’s ID please check this post [...]

  3. Neal says:

    Thanks – this really beats searching through source!

  4. Rebecca says:

    I am trying to import Activities but I get the impression I need an ActivityID – where can I find out what these are?

  5. Ale says:

    @Rebecca: how about running a report on Activities including the Activities IDs? :)

  6. Susan says:

    Hi there,
    How can I find the id for user fields? I am trying to create a user from a contact record and prepopulate some of the fields….
    Thanks

  7. Susan says:

    …actually I found them. I posted them here if anyone is interested:
    http://community.salesforce.co.....e.id=11864

  8. Jon says:

    We are using Salesforce.com as a helpdesk application. Currently, we have to enter information in the case close window in order to close a ticket. We need to setup a button on our cases to allow us to bypass this and automatically close a case with generic information. Does anyone know of any code that will allow us to do this? I talked with Salesforce and they told me that we need to set up an S-Control, but that they can’t help me with that. I’m a novice so any help would be appreciated.

    Thanks!

  9. Daniel Ruitman says:

    the type field on activities is tsk10 much like the event type field evt10

  10. Steve says:

    Hi

    We have a custom field in Sales Force and a have a simple web-to-lead form on our website that uses ringlead to pass the lead to Sales Force.

    The Custom ID and Name that Sales Force gave us for inclusion on this form (to be attached to the ‘region’ field) is:

    0N30000000mnNj

    This is a nightmare for clientside javacript/ajax validation as

    IT IS NOT WEB COMPLIENT – name an id should not begin with a digit, should begin only with a letter. please see W3 ‘s website:

    http://www.w3.org/TR/html401/types.html#type-id

    This is a serious problem as I am unable to write ANY JavaScript validation for this field and subsequently data is lost and leads are not being distributed correctly which is harming our business. Why could sales force not spot this and is there a way to customise this custom field name and id so that at least it starts with a letter???

    Has anyone come against this issue and found a work-around in JavaScript validation???

    Thanks

  11. Ale says:

    @Steve: Thanks for pointing this out; I believe the forms will post the values to Salesforce if only the NAME attribute contains the actual Id of the field; this shouldn’t prevent you from changing the value of the ID attribute to something more comprehensible (eg: “region”) and validate the field via Javascript using something like: getElementByID(“region”).

    Please let us know if this helps (works).

  12. [...] Most standard and custom fields on any object can be pre-filled using a URL parameter. You just need to figure out the corresponding parameter name. In this case, the parameter opp3 corresponds with the Opportunity Name field. Here’s a good post that provides the instructions and a complete list: Decoding Salesforce. [...]

  13. Susan says:

    Hi there – minor correction – the Status field is actually tsk12 not tsk4

  14. JD says:

    I can’t get custom lookup fields to populate with data using this method, am I missing something?

  15. Olof says:

    Thanks!!!

  16. Is there any way to programmatically get at this ID from the API? I need to get a list of Field Name & Field ID. Having to manually hover and copy past the Field ID from the URL just doesn’t seem right.

  17. Jayster4 says:

    Thanks for the info here. It helped jump start my first efforts at a custom button…I am setting several field values successfully. However, I can not seem to figure out how to set the “Reminder” checkbox to ‘empty’ (false, 0, whatever). Nor can I locate that fieldID…. any help?

    Jay

  18. Matthew says:

    An easier way to get all of your ID numbers from Salesforce is to generate a web to lead form in the setup control panel. Just make sure that you create a web to lead form with all of your fields.

    Salesforce will then generate an HTML file with a form that has the names and ID numbers for every field in your account.

  19. Lenny says:

    I’m trying to use a custom URL button to change a record type. How do i find the Field ID for RecordTypeID on the account?

  20. sandrar says:

    Hi! I was surfing and found your blog post… nice! I love your blog. :) Cheers! Sandra. R.

  21. Bella says:

    What about code for custom objects?

  22. Carrie Philipp says:

    What are the field names for Lead Owner, Account Owner, and Contact Owner? Anyone been able to hack this? I know Owner ID, but formulas like OwnerId . Email return a syntax error that OwnerId that field (OwnerId) does not exist.

Sorry, comments are closed.