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
GoJoyGoJoy 

How to Pre-populate Text field based on a Contact Lookup field on the Opportunity Page?

Hi,
I need your help.
On Opportunity page, there is a "Contact" lookup field.
Based on Contact person, we want a Text "A" field to be populated.

Text "A" field is displayed as a Text field on the opportunity and "PickList" on the Contact Page.

Since there is a relationship between Contact and Opportunity record on "A" field, I would like to have this field duplicated.

How do you do this?

 
Best Answer chosen by GoJoy
Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri

Take field on the Opp as formula text field, and use this formula

IF( ISBLANK( Contact__c), " ", TEXT(Contact__r.fieldname) )

 

All Answers

Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri

Take field on the Opp as formula text field, and use this formula

IF( ISBLANK( Contact__c), " ", TEXT(Contact__r.fieldname) )

 

This was selected as the best answer
Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri
If you want to prepoluate use JS button to create Opp and use URL hacking
GoJoyGoJoy
Hi,
Thank you so much for your response!
I get an Syntax error, "Formula result in data type (Text), incompatible with expected data type (true or false)

Is it because "A" field I'm trying to auto populate is a Picklist field on the contact record?
 
Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri
I think you have not select type text while creating formula field, please check it once.
GoJoyGoJoy
Hi,
I am new to writing advance updates like this so I appreciate your help.
1) Created a Workflow on Opportunity Object
2) Evaluation Criteria - created, and every time it's edited
3) Rule Criteria Is

IF( ISBLANK( Initial_Contact_Name__c),"",  TEXT( Initial_Contact_Name__r.A))

Syntax Error message: Error: Formula result is data type (Text), incompatible with expected data type (true or false).


What I want my outcome would be:
- When Initial Contact Name is edited (Lookup) on the Opportunity record to Contact.
- "A" field to be auto updated upon record is saved.

This "A" field is a Text box on the Opportunity Page also, this same field is a Contact record which is a Picklist field.

Thank you so much for your guidence,
Soo
Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri
Hi GoJoy, Please create formula field instead of workflow, if you still want to use workflow the check if Initial_Contact_Name__c not null in criteria and in field update formula use this TEXT (Initial_Contact_Name__r.A)
GoJoyGoJoy
Hi,
I would like to create a formula field but "A" gets auto populated from the Lead Conversion.  If I change it to a formula field then I would need to create a new field.

I don't think I'm doing this correctly because it's not being updated.
Would you mind writing it for me?
GoJoyGoJoy
Also,I would like to correct that "A" field on the Opportunity Page is a Picklist rather a text.
Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri

Hey,1) first delete the exsisting field on opportunity which displays picklist value.
2) Create a formula field with datatype Text and paste this formula IF( ISBLANK( Initial_Contact_Name__c),"",  TEXT( Initial_Contact_Name__r.A))

 

GoJoyGoJoy
Thank you!

My next question is then how do I migrate old data into the new field?
It should be something like when a record is edited right? I have to create an edit field and deactivate all validation rules?
Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri
@GoJoy, you don't need to do any thing when creatd formula field you will automatically get all the required data from the contact.
GoJoyGoJoy
Thank you so much for all your help!
Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri

Most Welcome,

if everything works perfect mark my answer as the best answer please. 
​Thank you

GoJoyGoJoy
Yes!  I did :-)
thank you again