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
tsantoshkumar111.3921413439334087E12tsantoshkumar111.3921413439334087E12 

Update the custom field in the USER..

HI Members,


i have a requirement.
i  want to create a custom using the javascript on an object . onclicking the object the particular record id should get updated in the custom field on the user object.

custom field api in the USER object is house_hold__c and object  API is student__c(this record id should get updated on the USER custom field house_hold__c) i want to update it dynamically.


thanks in advance.
Ashish_SFDCAshish_SFDC
Hi Santosh,


You have to have the Look up relationship from user object to the Other Object where the event is tracked.

You have to write a trigger on user object when the related field meets the criteria to update the field in User object.

See a small sample below,

Trigger FIELD1_Search_Trigger on User (before insert, before update) {
for (User obj: trigger.new){
if (User__R.obj(__c).FIELD2__c != obj.FIELD1__c)
obj.FIELD2__c = obj.FIELD1__c;
}
} etc


Regards,
Ashish