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
IFlyFishIFlyFish 

OpportunityStage as lookup or picklist field

In our application we want to create a custom field that is either a lookup type of the SFDC OpportunityStage or a picklist type of the OpportunityStage: StageName.  After spending some time searching for a solution, I haven't been able to find a way to do this.  Any help would be greatly appreciated.
Carl_V1Carl_V1

Hi there,

Sorry - bit confused as to what you want exactly?

IFlyFishIFlyFish

Hi Carl,

 

OK, let me try this again.  I am adding a custom field to the database and want to create a lookup relationship to an OpportunityStage record for the new field.  When I select New from Custom Fields & Relationships and then select Lookup Relationship and Next the Related To selection list does not include OpportunityStage (which is a standard Salesforce table) as one of the selections.

If it isn't possible to create this relationship, is there some way to create a Picklist relationship with a field in the OpportunityStage table?

 

Thanks,

Carl_V1Carl_V1
Thanks for re-explaining.
 
Whilst you wont be able to link to the Oppstage, may I ask why you would want to do that?  Why wouldnt you just create a stand alone custom picklist field that has the same stage values as the Opportunity Stage field?  You'd only want to use a lookup if you're trying to link records from one table to records in another. What is the objective of linking to the Opp stage field?
IFlyFishIFlyFish
We want to be able to modify an opportunity's pipeline status either from our application or from the standard Salesforce interface.  If the status is changed in our application it will update the pipeline Stage field in the Opportunity table (which has a lookup reference to OpportunityStage table) as well as our custom field.  If the stage it is changed via the Salesforce standard interface, our field will (intentionally) not be updated.  This will allow us to detect when the status is updated via Salesforce and take appropriate action within our application.  So we need our custom field to reference the same stage information that the Salesforce Opportunity Stage field references.  We are concerned that pipeline stages can be added or deleted in the OpportunityStage table and our application needs to maintain referencial integrity for this custom field . 
 
If a lookup relationship isn't possible (bummer), a picklist might do the trick.  However, manually creating the list will not solve the problem, since the opportunity stages might be changed without the users' knowledge; therefore the picklist might not accurately reflect the current pipeline stages.  I don't know how to create a relationship between the picklist items and a field in the OpportunityStage table.  Is there a way to do this? 
 
Thanks,
Carl_V1Carl_V1

When you refer to your application I assume you are meaning an application you're building within sf.com, as distinct to an external app.

If this is so, then you may want to consider using a custom form. This would be generated by an s-control referenced by a custom button or an inline s-control that is executed on a page load.  The s-control could generate a form that contains content(including picklists) that you have populated using a query to the OppStage table.  This happens each time the form is generated. Thus, if Opp stage values are changed, then the very next time the s-control runs it will reflect those new values.

Hope this suggestion helps.
IFlyFishIFlyFish
Your proposed solution is basically what I'm doing.  Maybe some future release will allow users to create lookup relationships to the same tables that Salesforce can access.  Thanks for you input.