function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Urgent requirement, pls help

Hi All,


I have a requirement, there is two object, one standard(Account), one custom(Deal), and look up relation is there.

I made one VF page on Account, and there is lookup for Deal name, what my requirement is:


On the selection of particular deal name thru lookup ,few field from "Deal" should be auto populated in some field of "Account".



There is Phone number in deal object, when user choose Deal1, then phone number associate with deal1 should populate in Phone number field in Account object.


Please help in this, and provide sample code.







You can try the below code


trigger SiteAddressTrigger on Contact (before insert){

 Set<Id> conIds = new Set<Id>();
  Map<Id, Site_Address__c> siteMap = new Map<Id,Site_Address__c>();

 for(Contact c :{




for(Site_Address__c sc:  [select Id,ContactId,Shipping_State_Province__c from Site_Address__c where ContactId IN: conIds]){

  sitemap.put( sc.ContactID,sc);

 for(Contact c : Trigger.New){

     c.MailingState = sitemap.get(c.ID) .Shipping_State_Province__c;