+ Start a Discussion
Leonard Silon 8Leonard Silon 8 

How do I get the user ID from a text field?

I have two objects - Object A and Object B
Object A has a field that looks up to Object B and is the record label
On object B there is a text field with a user's full name in the firmat of "firstname Lastname"
I need to be able to look at that field and then make the user in the text field on Object B be the owner of the record in Object A

Object B
Record name = 107 Mark*John
Text field data = Mark Jones

Object A
Lookup field has a link to Object B and in that field is "107 Mark*John"
Since that is the record connected to Object A and "Mark Jones" is in the text field on Object B, I want the owner of that record in Object A to now be Mark Jones and updated any time the look up field on Object A changes

Any help welcomed!
Prateek Singh SengarPrateek Singh Sengar
Hi Leonard,
You will require a trigger on object A. The trigger should be on before update and before insert. In this trigger perform the following

1) Check if the lookup field to object B is populated.
2) Check if the text field data is popualted (in related object B)
3) Query user object where first name and last name matches your criteria
4) Assign the owner ID of object A record to the user id obtained at step 3.

Hope this helps.
Leonard Silon 8Leonard Silon 8
well poo! Was hoping for no trigger. Thanks!