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
Kate StarostinaKate Starostina 

How do I link a custom field between two objects?

I have the opportunity standard object with a custom field called "serial number."  This field is set to look up from  a custom object called "Inventory" where these serial numbers are logged.  The inventory object has all the pertinent info that I need regarding that serial number and also a field called "opportunity." When I create an opportunity, I go the "serial number" field and look up the serial number I need from the inventory object.  This works fine.  What I am trying to do is have the "opportunity" custom field on the inventory object populate the opportunity name where that serial number is assigned automatically.  It seems that I need to use a formula, but I can't get it to work.  Please help!
Suneel#8Suneel#8
Formula field doesn't work here as you don't have any reference to the Opportunity in Inventory object.Also VLOOKUP is currently limited in only Validation rules.So you should write after update and after insert triggers on Opportunity object to populate Opportunity reference in Inventory whenever there is change in SN field
Kate StarostinaKate Starostina
Thanks Suneel#8.  How do I go about writing a trigger.  I don't know how to code.