You need to sign in to do that
Don't have an account?
Raj R.
How to gray out a custom Opportunity Field through Apex Trigger or validation rule?
Hi,
The current scenario is that a custom Opportunity Field (Cfield__c) needs to be required when the Opportunity.Amount >= $200,000 and Stage is A,B,C, and E. Through the UI, a red bar needs to appear next to the field to indicate it is required when it meets the criteria above, but needs to be "grayed out" (not visible) if the Amount < $200,000.
How may i use an apex trigger or validation rule to do this? If this cannot be done with Apex Trigger or validation rule, what other method may I use? Ideally I would like to stay away from overriding the Opportunity Edit page with a VF page.
I thought i could do this with Salesforce Flow, but I am new to that and it seems cumbersome to get that to work.
Requirements:
The current scenario is that a custom Opportunity Field (Cfield__c) needs to be required when the Opportunity.Amount >= $200,000 and Stage is A,B,C, and E. Through the UI, a red bar needs to appear next to the field to indicate it is required when it meets the criteria above, but needs to be "grayed out" (not visible) if the Amount < $200,000.
How may i use an apex trigger or validation rule to do this? If this cannot be done with Apex Trigger or validation rule, what other method may I use? Ideally I would like to stay away from overriding the Opportunity Edit page with a VF page.
I thought i could do this with Salesforce Flow, but I am new to that and it seems cumbersome to get that to work.
Requirements:
- Opportunity.Amount >= $200,000
- Stage = A,B,C, and E.
- Cfield__c is required (dropdown with Yes or No as values)
- Red bar appears next to Cfield__c to indicate it is required.
You could achieve this using recordtypes, pagelayouts and workflow rules.
For your reference :
Creating record type and page layout : https://www.youtube.com/watch?v=JUFq1do07fA
Changing Record Type using Workflow Rules : https://help.salesforce.com/apex/HTViewSolution?id=000205890&language=en_US
All Answers
You could achieve this using recordtypes, pagelayouts and workflow rules.
For your reference :
Creating record type and page layout : https://www.youtube.com/watch?v=JUFq1do07fA
Changing Record Type using Workflow Rules : https://help.salesforce.com/apex/HTViewSolution?id=000205890&language=en_US
Validation rule 1 : To make Cfield__c required Validation rule 2: To make Cfield__c non editable field when Amount is < 200000
Thanks,
Karan
I am going to try both and I shall update the question as soon as I can get some analysis.