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
mluisimluisi 

dependent editable field help

We created a Custom Probability % field on the Opportunity. User would like it to pre-populate with a given value based on the Stage and also be able to edit the percentage as needed. I tried a formula below (which is probably not correct) and received "Error: Field StageName may not be used in this type of formula" 
  • IF(StageName=ISPICKVAL("5 - Contract in Process"),90,(IF(StageName=ISPICKVAL("4 - Negotiate Terms"),75,(IF(StageName=ISPICKVAL("3 - Obtaining Approval"),25,(IF(StageName=ISPICKVAL("2 - Expressed Interest"),10," ")))))))
Where do I go from here, please? 
AnkaiahAnkaiah (Salesforce Developers) 
Hi , 

try with below code.
 
IF(Text(StageName)= "5 - Contract in Process",90,
  (IF(Text(StageName)="4 - Negotiate Terms",75,
     (IF(Text(StageName)="3 - Obtaining Approval",25,
        (IF(Text(StageName)="2 - Expressed Interest",10,0)))))))

If this helps, Please mark it as best answer.

Thanks!!
 
mluisimluisi
Thanks for your response. Unfortunately I get the same error. Not sure we can make a picklist field meet a formula and still be able to edit? 
AnkaiahAnkaiah (Salesforce Developers) 
You need to create custom formula field and the return type should be percentage.

Please make sure formula fields should not be editable
AnkaiahAnkaiah (Salesforce Developers) 
Can try to use the standard functionality for opporunity stage update. It will work as you expected.

While adding picklist values to stage, it will ask for Probability. Please refer the below screenshot for your reference.

User-added image

when you select the stage as 2 - Expressed Interest then probability should be 10%. as like below.
User-added image

After some time, If you want to change the probability for the same stage, you can able to do that. Please refer the below screen shot.

User-added image

Thanks!!
 
Gonapati Bhavitha 11Gonapati Bhavitha 11
Hi mluisi,

You can make the Proabability a Formula field with a Return type Percent.
 
The formula for Probability will be as below
CASE(Stage__c,
"Initial Contact", 0.1,
"Proposal", 0.50,
"Closed Won",1,
0)


If this helps,Please Mark It as best answer.

Thanks!