How do I reference the name of Object X in a field in Object Y after Object Y was selected via lookup under a field of Object X in Salesforce?

23 views Asked by At

I'm new to Salesforce and am still learning the Apex language and how it works. I have an object called Purchase Orders and each one has a unique name and is tied to a specific Project. Under each project there are fields for different milestone activities like an audit or a building permit approval for example, which are our deliverables. Then there's also the activity object, which holds all the details of each activity, like the date that the deliverable was done, comments, etc.

Under the Purchase Order object there is a lookup field called "Activity Name" where users will designate the PO to the specific activity it is for, after it has already been assigned to a project.

In the activity object, I want to put purchase order details like the PO Number so that the user will see when they work on it, whether we have received a PO for that activity. I want to create a formula field under Activity that reflects the PO name it was entered under, while also considering that not every Activity will be assigned a PO (not all of them are financial).

How can I do this? Can I even do this or did I set it up wrong? Is there an easier way to tell my users whether an activity has been assigned a PO?

I have created a lookup field under activity to relate the activity object to the purchase order object called "Purchase Order Link" but I'm not sure where to go from there because I don't know how to tell Salesforce to link it to the specific purchase order where the project-specific activity was selected in the lPurchase Order Object lookup field. I know I am missing some things but I have no idea how or what. If you could also explain so that I can understand better it would be much appreciated and I can learn something new for the future. Thank you again so much.

0

There are 0 answers