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

Question about trigger to update lookup field with custom field in same object



Does anyone have an example how to write a trigger to update a lookupfield with a custom field in the same object?


My example:


I want to insert the field "Postalcode 4 dig" into the lookup field "Postcode". See screenshot:





When I manually insert the "Postalcode 4 dig" into the lookup field "Postcode" two fields will automatically be filled with help of a cross-object formula. So everything is working fine, except I don't want that the users have to copy the 4 digit postalcode into the lookup field.







According to your requirement you want into set the postcode lookup filed value as the “Postalcode 4 dig”.


But lookup field is used for the referencing or creating the relationship between two records of the same object or different object.


You can create a postcode field as formula field and in the formula field easily assign the Postalcode 4 dig value in postcode field.


Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 


Thanks. But that won't do the thing. The postalcode 4dig is necessary to do a lookup in the object "Postcode"


Can you please check my previous post and its replies. Sorry normally I don't start a new message on the same topic, but nobody was replying, and I need this to be solved quickly :smileyembarrassed: