• No se han encontrado resultados

The following table describes the methods available as part of the field describe result. None of the methods takes an argument.

Description Data Type

Name

For variable-length fields (including binary fields), returns the maximum size of the field, in bytes Integer

getByteLength

Returns the formula specified for this field String

getCalculatedFormula

Returns the token of the controlling field Schema.sObjectField

getController

Returns the default value for this field Object

getDefaultValue

Returns the default value specified for this field if a formula is not used

String getDefaultValueFormula

Returns the maximum number of digits specified for the field. This method is only valid with Integer fields Integer

getDigits

Returns the content of the field-level help. For more information, see "Defining Field-Level Help" in the Salesforce online help.

String getInlineHelpText

Returns the text label that is displayed next to the field in the Salesforce user interface. This label can be localized.

String getLabel

For string fields, returns the maximum size of the field in Unicode characters (not bytes)

Integer getLength

Returns the name of the field, similar to the getName method. However, if the field is part of the current String

getLocalName

namespace, the namespace portion of the name is omitted.

Returns the field name used in Apex scripts String

getName

Returns a list of PicklistEntry objects. A runtime error is returned if the field is not a picklist.

List <Schema.PicklistEntry>

getPicklistValues

For fields of type Double, returns the maximum number of digits that can be stored, including all Integer

getPrecision

numbers to the left and to the right of the decimal point (but excluding the decimal point character) Returns a list of DescribeSObjectResult objects for the parent objects of this field. If the

List <DescribeSObjectResult>

getReferenceTo

isNamePointing method returns true, there is

Field Describe Result Methods

Description Data Type

Name

more than one entry in the list, otherwise there is only one.

Returns the name of the relationship. For more information about relationships and relationship String

getRelationshipName

names, see Understanding Relationship Names in the Force.com Web Services API Developer's Guide.

For fields of type Double, returns the number of digits to the right of the decimal point. Any extra Integer

getScale

digits to the right of the decimal point are truncated.

This method returns a fault response if the number has too many digits to the left of the decimal point.

Returns one of the SoapType enum values, depending on the type of field. For more information, see SoapType Enum Values on page 113.

Enum value getSOAPType

Returns the token for this field Schema.SObjectField

getSObjectField

Returns one of the DisplayType enum values, depending on the type of field. . For more Enum value

getType

information, see DisplayType Enum Values on page 112.

Returns true if the current user can see this field, false otherwise

Boolean isAccessible

Returns true if the field is an Auto Number field, false otherwise.

Analogous to a SQL IDENTITY type, Auto Number fields are read-only, non-createable text Boolean

isAutoNumber

fields with a maximum length of 30 characters. Auto Number fields are used to provide a unique ID that is independent of the internal object ID (such as a purchase order number or invoice number). Auto Number fields are configured entirely in the Salesforce user interface.

Returns true if the field is a custom formula field, false otherwise. Note that custom formula fields are always read-only.

Boolean isCalculated

Returns true if the field is case sensitive,false otherwise

Boolean isCaseSensitive

Returns true if the field can be created by the current user,false otherwise

Boolean isCreateable

Returns true if the field is a custom field,false if it is a standard object

Boolean isCustom

Returns true if the field receives a default value when created,false otherwise. If true, Salesforce Boolean

isDefaultedOnCreate

implicitly assigns a value for this field when the object is created, even if a value for this field is not passed

Field Describe Result Methods

Description Data Type

Name

in on the create call. For example, in the Opportunity object, the Probability field has this attribute because its value is derived from the Stage field. Similarly, the Owner has this attribute on most objects because its value is derived from the current user (if the Owner field is not specified).

Returns true if the picklist is a dependent picklist, false otherwise

Boolean isDependantPicklist

Returns true if the field is used as an external ID, false otherwise

Boolean isExternalID

Returns true if the field can be used as part of the filter criteria of a WHERE statement,false otherwise Boolean

isFilterable

Returns true if the field has been formatted for HTML and should be encoded for display in Boolean

isHtmlFormatted

HTML,false otherwise. One example of a field that returns true for this method is a hyperlink custom formula field. Another example is a custom formula field that has an IMAGE text function.

Returns true if the field can be used to specify a record in an upsert method,false otherwise Boolean

isIdLookup

Returns true if the field is a name field,false otherwise. This method is used to identify the name Boolean

isNameField

field for standard objects (such as AccountName for an Account object) and custom objects. Objects can only have one name field, except where the

FirstName and LastName fields are used instead (such as on the Contact object).

If a compound name is present, for example, the Name field on a person account,isNameField is set to true for that record.

Returns true if the field can have multiple types of objects as parents. For example, a task can have both Boolean

isNamePointing

the Contact/Lead ID (WhoId) field and the Opportunity/Account ID (WhatId) field return true for this method. because either of those objects can be the parent of a particular task record. This method returns false otherwise.

Returns true if the field is nillable,false otherwise.

A nillable field can have empty content. A Boolean

isNillable

non-nillable field must have a value for the object to be created or saved.

Returns true if the field is a restricted picklist, false otherwise

Boolean isRestrictedPicklist

Returns true if a query can sort on the field,false Boolean

isSortable

Field Describe Result Methods

Description Data Type

Name

Returns true if the value for the field must be unique,false otherwise

Boolean isUnique

Returns true if the field can be edited by the current user,false otherwise

Boolean isUpdatable

DisplayType Enum Values

A DisplayType enum value is returned by the field describe result's getType method. For more information, see Field Types in the Force.com Web Services API Developer's Guide.

What the Field Object Contains Type Field Value

Any value of the following types:String,Picklist,Boolean,Integer,Double,Percent, ID,Date,DateTime,URL, or Email.

anytype

Base64-encoded arbitrary binary data (of type base64Binary) base64

Boolean (true or false) values Boolean

Comboboxes, which provide a set of enumerated values and allow the user to specify a value not in the list

Primary key field for an object ID

Integer values Integer

Multi-select picklists, which provide a set of enumerated values from which multiple values can be selected

MultiPicklist

Percent values Percent

Phone numbers. Values can include alphabetic characters. Client applications are responsible for phone number formatting.

Phone

Single-select picklists, which provide a set of enumerated values from which only one value can be selected

Picklist

Cross-references to a different object, analogous to a foreign key field Reference

String values String

String values that are displayed as multiline text fields TextArea

URL values that are displayed as hyperlinks URL

Field Describe Result Methods

PicklistEntry Methods

Picklist fields contain a list of one or more items from which a user chooses a single item. They display as drop-down lists in the Salesforce user interface. One of the items can be configured as the default item.

A PicklistEntry object is returned from the field describe result using the getPicklistValues method. For example:

Schema.DescribeFieldResult F = Account.Industry.getDescribe();

List<Schema.PicklistEntry> P = F.getPicklistValues();

You can only use 10getPicklistValue method calls per sObject during the execution of an Apex script. For example, an Apex script can execute 10getPicklistValue method calls for a field on Account, then another 10 for a field on Lead. For more information about governor limits, see Understanding Execution Governors and Limits on page 142.

The following table describes the methods available as part of the PicklistEntry object. None of the methods take an argument.

Description Data Type

Name

Returns the display name of this item in the picklist String

getLabel

Returns the value of this item in the picklist String

getValue

Returns true if this item must be displayed in the drop-down list for the picklist field in the user interface,false otherwise

Boolean isActive

Returns true if this item is the default value for the picklist,false otherwise. Only one item in a picklist can be designated as the default.

Boolean isDefaultValue

SoapType Enum Values

A SoapType enum value is returned by the field describe result getSoapType method. All of the values preceded by xsd:

are XML schema primitive data types. For more information about the XML schema primitive data types, see the World Wide Web Consortium’s publication XML Schema Part 2: Data Types at:http://www.w3.org/TR/xmlschema-2/.

Description Value

Unique ID values associated with an sObject tns:ID

ID, Boolean, Double, Integer, String, Date, or DateTime values xsd:anyType

Documento similar