You need to sign in to do that
Don't have an account?

How to hide a field through Apex code???
Hi to all,
I am using Lead object & the lead source field adds some Extra values like web,email,phone.
Now I added one custom field Lead No.
If I choose Lead source to Web,phone,email then lead no is increased by 1.
If I choose Lead source to Other than above three The Lead No Custom Field should be hodden.
How to hidden a Fields through APEX code???
Thanks,
Krishna.
All Answers
http://wiki.developerforce.com/index.php/Visualforce_DynamicEditPage
Here's a link to the concept in case you have problems accessing the Cookbook (I had a problem earlier today).
Key takeaway is to rerender the pageblock, not just the section or sectionitem as I haven't found a way to make that work (despite 2hrs of trying).
thanks sfdcfox,
I got by using Page Layout & record types.
I am creating 2 record types that have different layouts.
One layout has that custom field another one not get.
I am using the Trigger are as follows,
trigger trg_Lead on Lead (before insert)
{
for (Lead objLead : Trigger.new)
{
if(objLead.LeadSource != null)
{
// Check the Lead status is Phone,web or Mail & update the Lead No Custom Field.
}
else
{
RecordType[] rt = [select Id,Name from RecordType where Name =: 'Test Lead']; //Test Lead is a RECORD TYPE.
integer NsSize = rt.size();
for(integer i = 0; i < NsSize ; i++)
{
objLead.RecordTypeId = rt[i].Id;
}
}
}
}
Thanks,
Krishna.