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
Allen2Allen2 

Hi!!! Please help me to write the validation rule on the opportunity object.

Created two field (data type-picklist) on the opportunity and have to make the fields mandatory when advancing a F S opportunity beyond Stage 2.  Make mandatory for the profile F S S R and F S S M only. 

for this scenario have to create a validation rule. Please help me out for this..
 
and if the scenario will be changed to 

According to the above scenario 2 fields (data type-picklist) should be mandatory based on the user profile (F S S R or F S S M).  Instead we would like the validation rule to be if the Sales Occupy (a picklist field on opportunity) = Field Sales, then the 2 fields are mandatory. 
 
please help me to write the validation rule for both the scenarios...

Thank you!!
Aladin BanwalAladin Banwal
This can be done using a page layout.
Don't make the 1st field (for FSSM profile) or 2nd field(for FSSR field) required on the field level.

Create one Page Layout and there make the 1st field required on Page layout
Similarly, create second page-layout where the 2nd field required on the Page Layout.

Then, assign the 1st Page Layout to those for whom you want to have FSSM required. and assign 2nd to those for whom you want to have FSSR required.

You can also create record-type if you have any profile that needs to use both the Page Layout.
Aladin BanwalAladin Banwal
Yes, of course, It won't.

You only have to create Page Layouts for both the profiles and pull up those fields which you want to make required on both Profiles. 
Now make 1st Page Layout for 1st Profile and 2nd Page Layout for 2nd Profile.
Then make that field required for which profile you want in related Page Layout.

Note: Don't make that field required in validation rule or field level.
Allen2Allen2

Okay if it is changed to second scenario

not using user profile to make it mandatory then how to write the validation rule for that

 

I have written one validation rul taking 2nd Scenario but it is making only one field mandatory not 2nd.
 
AND ( ISPICKVAL(Sales__c, 'Field Sales'), ISBLANK ( TEXT ( Fin_Se__c ) ) && ISBLANK ( TEXT ( Fin_Se_Type__c ) ) )
 
Here it is making the field Fin_Se__c mandatory but not the 2nd field Fin_Se_Type__c

Aladin BanwalAladin Banwal
Try this:
AND ( ISPICKVAL(Sales__c, 'Field Sales'), ISBLANK ( TEXT ( Fin_Se__c ) ) || ISBLANK ( TEXT ( Fin_Se_Type__c ) ) )
Allen2Allen2

Thanks Aladin for the correction.

Want to add one more condition. 

If the Sales Occupy = Field Sales AND the stage is advancing beyond Stage 2, then these 2 fields mandatory.

I tried below... but not working....Could you please correct me??

AND ( NOT ( ISPICKVAL ( StageName,  '2. Discover' )  )  ),
 ISPICKVAL(Sales__c, 'Field Sales'), ISBLANK ( TEXT ( Fin_Se__c ) ) || ISBLANK ( TEXT ( Fin_Se_Type__c ) ) )

Aladin BanwalAladin Banwal
Try this:
AND(
NOT(
ISPICKVAL(StageName , "2. Discover")),
ISPICKVAL(Sales__c, "Field Sales"),
ISBLANK ( TEXT ( Fin_Se__c  )) && ISBLANK ( TEXT ( Fin_Se_Type__c )))
Aladin BanwalAladin Banwal
And give an error message on the top not on the field so it'll give the error for both the fields.

Please mark as best answer if it solved your problem.
Thanks