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
devforce_111devforce_111 

help with updating fields

HI ,

 

 Map<Id,Contact[]> entries = new Map<Id,Contact[]> ([Select Email ,Code__c Advisor__c   from Contact where  Account.Name  = Test' and id IN :userEmails]);

 

for(User u :trigger.new)

{

How can i update my user fields test_1__c , test_2__c with the values of the contact fields Code__c and Advisor__c

(test_1__c = code__c and test_2__c = Advisor__c)

}

 

any help is appreciated!!

Thanks

kiranmutturukiranmutturu

what is the key field in your scenario? y beacuse consider if owner is the key field... u may have n number of contacts for one owner and all the contacts have different values for the same onwer.. so what is the criteria here to assign the contact values to the user?....

 

devforce_111devforce_111

The criteria is matching the email id of the contact to that of user. but there might me multiple contacts with the same email id but the field values on the contacts will be same for the respective email id.

 

Thanks