+ Start a Discussion
VFVF 

Avoid the system address fields of contact populated automatically when created from an account

Need to avoid the system address fields being populated with Account address automatically whenever we create a contact from account page.

 

Whenever a contact is being created from an account page the account field is populated automatically and the system address field of contact are populated by account address.

 

Tried overriding the create contact button with scontrol and javascript, but whenever the account is passed while creating a contact the address fields gets populated automatically.

 

Please let me know if any soln?

 

Thanks

shaan

craigmhcraigmh

The field describe info doesn't have a method for system fields:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_fields_describe.htm

 

But there's a list of them here:

http://www.salesforce.com/us/developer/docs/api/Content/system_fields.htm

 

So I used this code:

Set<string> systemFields = new Set<string> {'Id','IsDeleted','CreatedById','CreatedDate','LastModifiedById','LastModifiedDate','SystemModstamp'};

if(!systemFields.contains(objField.getDescribe().getName())) {
   //do stuff
}