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
user10286user10286 

Populate values

Hi All

   1. I have create custom user lookup field in Account ,field name"SalesRep"

    2.create custom Account lookup  field in Site custom object,field name "Main Builder"

   3.and also create custom user lookup  field in Site custom object,field name "Exo SalesRep"

when i select account in "Main Builder" ,the relevant account user name will be populate in "Exo SalesRep" field.

Plz anyone solve the issues

 Advance thanks

sushant sussushant sus
trigger updatuser on site(before insert,before update)
{
list<account> listaccount=new list<account>();
map<id,id> mapaccount=new map<id,id>();
for(site s:trigger.new)
{
listaccount.add(s.accountid,);
}
list<account> acc=[select user__c,name from account where id in:mapaccount];
for(account ac:acc)
{
mapaccount.put(ac.id,ac.user__c);
}

for(site s:trigger.new)
{
s.user__c=mapaccount.get(s.accountid);
}
}

or you can use workflow for this also ....