+ Start a Discussion
jaanvivekjaanvivek 

Help On Formula Field

I need to implement one functionality in opportunity object. Please find below mentioned functionality.

 

Scenario-

 

If "Stage" for opportunity is "propecting" i need to display  "1 Green Flag" ,

If  "Stage" for opportunity is "Closed-Won" I need to display  "2 Red Flags",

if "Stage"  for opportunity is "Closed-Lost"  I need to display "3 yellow Flags"

 

And

 

if  "Stage for ooportunity is " Closed-Won" the Opportunity must be "non-editable".

 

Could anyone please help me how to implement it.

 

Thanks for your all valuable help.

 

Thanks,

JaanVivek

Best Answer chosen by Admin (Salesforce Developers) 
SFDC_VikashSFDC_Vikash

Hi

 

For displaying the images you have to create a formula field on opportunity with return type 'text', then you can use the formula as follows :

 

CASE(StageName,
"Prospecting",IMAGE("/img/samples/flag_green.gif","Green Flag"),
"Closed Won",IMAGE("/img/samples/flag_red.gif","Red Flag",16,16) & IMAGE("/img/samples/flag_red.gif","Red Flag",16,16),
"Closed Lost",IMAGE("/img/samples/flag_yellow.gif","Yellow Flag",16,16) & IMAGE("/img/samples/flag_yellow.gif","Yellow Flag",16,16) & IMAGE("/img/samples/flag_yellow.gif","Yellow Flag",16,16),
IMAGE("/s.gif","Blank")
)

 And to disable to edit an opportunity on stage "Closed Won", you have two ways :

 

1) You can add a validation rule which will display an error message when an Opportunity with StageName equals "Closed Won " is edited.

 

2) You can add a recordtype and assign a non editable page layout for it, then create a workflow that will change the record type for the opportunity when its stage is updated to "Closed Won'.

 

Please mark it as solution if your problem is get solved by this so that others can also use this.

 

 

All Answers

SFDC_VikashSFDC_Vikash

Hi

 

For displaying the images you have to create a formula field on opportunity with return type 'text', then you can use the formula as follows :

 

CASE(StageName,
"Prospecting",IMAGE("/img/samples/flag_green.gif","Green Flag"),
"Closed Won",IMAGE("/img/samples/flag_red.gif","Red Flag",16,16) & IMAGE("/img/samples/flag_red.gif","Red Flag",16,16),
"Closed Lost",IMAGE("/img/samples/flag_yellow.gif","Yellow Flag",16,16) & IMAGE("/img/samples/flag_yellow.gif","Yellow Flag",16,16) & IMAGE("/img/samples/flag_yellow.gif","Yellow Flag",16,16),
IMAGE("/s.gif","Blank")
)

 And to disable to edit an opportunity on stage "Closed Won", you have two ways :

 

1) You can add a validation rule which will display an error message when an Opportunity with StageName equals "Closed Won " is edited.

 

2) You can add a recordtype and assign a non editable page layout for it, then create a workflow that will change the record type for the opportunity when its stage is updated to "Closed Won'.

 

Please mark it as solution if your problem is get solved by this so that others can also use this.

 

 

This was selected as the best answer
jaan.vivek746jaan.vivek746

Thanks Vikash. It's working fine.

 

 

Thanks,

JaanVivek

SFDC_VikashSFDC_Vikash

Please mark it as solution