+ Start a Discussion
gappmangappman 

need help creating a custom field

Hello,

In Contacts tab, i would like to create a new custom field.  Can you show me the proper syntax.

 

I want to create a field titled "OpptyStage". i suppose it will be a text field.

 

I want the value of "OpptyStage" to equal the field titled "Stage" within the Opportunity Tab.  It's also known as StageName.

 

Please show me how to create this field.

 

Ultimately whart i am trying to accomplish is filter my 1,000 contacts to list only those that are associated with an active Opportunity. To do this, my thinking is to pull in the Opportunity Stage and use that for filtering the contacts.  This will yield something like 50 contacts for me.  If you have any other suggestions of how to get this view, I am all ears.

 

Thanks for your help

Gappman

Best Answer chosen by Admin (Salesforce Developers) 
LegendLegend

Hi Gappman,

 

Looks everything fine. Now go to the Contact record and select any oppty in Opportunity lookup field. 

As you save the record, the OpptyStage field gets populated.

All Answers

MandyKoolMandyKool

You can create custom field by going to 

 

Setup -> Customize -> Contacts -> Custom Fields

gappmangappman

Kulkarni

I got that part. When i go there, i attempt to create a new custom field.

 

I select "formula"

I select "text"

I type:  OpptyStage    as my new field name.  salesforce auto populates the other field.

 

At the bottom I type:   TEXT(Opportunity.Stage) and i get a syntax error saying "opportunity is invalid"

 

I try Oppportunities, Oppty and nothing works.  I clearly dont know the proper syntax or if this is even possible.

 

Any idea on the proper syntax?

 

thanks,

Gappman

LegendLegend

Hi,

Is there any relationship between Contact and Opportunity?
I mean, is there any lookup field on contact which is pointing to Opportunity?

After that only you can access the opportunity fields.

So first of all, create a lookup field on Contact pointing to opportunity. Now create another field (formula field: "OpptyStage") on contact having values as 'Opportunity__r.StageName'.

Please let me know if you face any issue.

gappmangappman

Legend,

I did what you suggested and created the fields with no syntax issues.  however the fields are blank.  no data is coming through.  I first created a field on Contact pointing to Opportunity:

 

Field Information:

*Field Label
 Opportunity
Data TypeLookup
*Field Name
 Opportunity
  
Description
1000 remaining
 
Help Text
255 remaining
This text displays on detail and edit pages when users hover over the Info icon next to this field.
Lookup Options:
Related ToOpportunity*Child Relationship Name
 Contacts
*Related List Label
 StageName

 

 

And then i created the field i really want. No syntax issues once i put "TEXT" at the beginning.

 

Field Information:

*Field Label
 OpptyStage
  
    
*Field Name
 OpptyStage
  
Description
1000 remaining
 
Help Text
255 remaining
This text displays on detail and edit pages when users hover over the Info icon next to this field.
Formula Options:
*Formula Return Type
 
Text
  

Enter your formula and click Check Syntax to check for errors. Click the Advanced Formula subtab to use additional fields, operators, and functions.

Example: Full Name = LastName & ", " & FirstNameMore Examples ...
 
OpptyStage (Text) =
 
TEXT(Opportunity__r.StageName)
 
Functions

 

 

But do data is coming back  The OpptyStage field should be returning any of the 13 choices in the picklist.  Any additional help is appreciated.  Thanks.

 

Gappman

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LegendLegend

Hi Gappman,

 

Looks everything fine. Now go to the Contact record and select any oppty in Opportunity lookup field. 

As you save the record, the OpptyStage field gets populated.

This was selected as the best answer
gappmangappman

Legend,

You are right.  Thanks for your help. Works well.

 

Gappman