Ajax (1) Apex Class (12) Apex Trigger (2) Community (2) Home Page (1) HTML (4) Integration (3) JS (7) KB (1) Label (1) Licenses (1) Listing (1) Log (1) OOPs (5) Sharing (1) Static Resource (1) Test Class (3) URI (1) Visualforce (10)

Thursday 22 May 2014

about schema picklist

Schema.DescribeFieldResult F = Account.Industry.getDescribe();
List<Schema.sObjectType> P = F.getReferenceTo();
====================================
  
// Create an account with predefined default values
Account acct = (Account)Account.sObjectType.newSObject(null, true);
// Provide a value for Name
acct.Name = 'Acme';
// Insert new account
insert acct;

===================================
Schema.DescribeFieldResult F = Account.Industry.getDescribe();
List<Schema.PicklistEntry> P = F.getPicklistValues();
===========================================
Schema.DescribeFieldResult F = Test__c.Box2__c.getDescribe();
List<Schema.PicklistEntry> P = F.getPicklistValues();
for(Schema.PicklistEntry obj:P)
{
system.debug('FieldLavel'+obj.getLabel()+'|FieldValue'+obj.getvalue());
}

No comments:

Post a Comment