You need to sign in to do that
Don't have an account?

Set custom field in user profile
Hi,
Without the ability to have lookup fields in the User profile or Workflows, I'm looking to try and Apex solution to my problem.
I would have a field on the User's profile called:
Region
I will also have an object which will have a lookup that will contain:
A user on the system
A region (which is a lookup field itself)
Using that user as the relationship, I want to pull off what Region they are and populate that field on the User profile.
Is this something that is relatively easy to achieve?
trigger test on custom object(before insert,before update)
{
for(customobject c:trigger.new)
list1.add(c.user__c);
list2.add(c.region_c);
map1.put(c.user__c,c.region__r.name)
}
list<user>u=[select name from user where id in:list1];
for(user u1:u)
{
u1.region__c=map1.get(u1.id);
}
}
update new User(Id = userId, Region = region);
Thanks guys, I shall have a play with your suggestions.