autopopulated a look up field each time a record is created - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
David ToxquiDavid Toxqui 

autopopulated a look up field each time a record is created

I want to autopopulate a lookup custom field with the opportunity name.

The lookup field is at Contacts because i use formula field to bring information from Opportunity to contanct

Now i want to automate this process each time a a new opportunity is created
pratima shrivastavpratima shrivastav
Hio David,
Can you please elaborate  on what you are trying to automate? Every time an Opportunity gets created, are you loking to create a related contact? 
Prashant PandeyPrashant Pandey
Hi David,

Did you create the formula on the contact object ?

Where did you create the lookup on contact or opportunity..?

--
Thanks,
Prashant
Narender SinghNarender Singh

Hi David,

You can do the following:

For classic:
Create a custom URL button on the contact object to create opportunity. And use URL hacking to pre populate your look up field.
URL hacking link: http://writeforce.blogspot.com/2013/01/prepopulating-fields-using-url-hacking.html

For lightning:

Create a quick action on Contact and select the target object as Opportunity. Define the layout for your action. Save it. And then in the 'Predefined Values' section of your action click 'New'. Choose your custom lookup field and use this formula:
Contact.Id

Save it.

NOTE: Don't forget to add the button/action to your contact page layout.

David ToxquiDavid Toxqui
I create a look up field at contact to get some information from the opportunity at the contact layout .... 2 fields, one lookup to get the opp, second formula to visualize one field from opportunity... i made a dataloader to fill the lookup field .
The next step is to automate this process each time i create a new opportunity fill the opp name at contact field and in this was the second formula work. 

I´m using taroworks and i want to show only the contacts with an opp and the status of the opp
pratima shrivastavpratima shrivastav
You want the Opportunity lookup on Contact to be populated by Oppirtunity value, every time you create an opportunity. You could use a process builder or flow to populate the lookup but What is not clear here is there should be a criteria otherwise, when an opportunity is created which contact's lookup field should the process populate? Does the Opportunity first gets created then you create the Contact on Opportunity? or is it the Opposite?
Please explain the process in steps. Like what gets created first and what are you expecting?
David ToxquiDavid Toxqui
First i create a contact
then i create de opportunity, when i set a contact and i sve the opp i want to related this record at my lookup field at contat
Prashant PandeyPrashant Pandey
Hi David,

You can create process builder or flow to populate the custom opportunity lookup field on the contact.

Or if you need a formula field then just create a formula field then create a custom formula field(Opportunity__r.Name) and remove the lookup field on the page layout.

Let me know if you need more details.

--
Thanks,
Prashant