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
LeeCLeeC 

Formula Help

Hello,

 

I am trying to create a formula which will check when a picklist value "Work Scheduled" is chosen that text is rather entered in DES Jobs or EMP Jobs field. unfortunately my formula isn’t working. Does anyone have any idea what I’m doing wrong?

 

AND(
OR(
(Agreement__r.DES_Job__c = ""),
(Agreement__r.EMP_Job_Number__c = "")),
ISPICKVAL( Job_Status__c ,"Work Scheduled")
)

 

 

Thanks in advance,

Best Answer chosen by Admin (Salesforce Developers) 
LeeCLeeC

I figured it out. Not sure if this is the best way but it works.

 

AND
(
        AND
        (
              (Agreement__r.DES_Job__c = ""),
              (Agreement__r.EMP_Job_Number__c = "")
        ),
ISPICKVAL( Job_Status__c ,"Work Scheduled")
)

All Answers

SporterSporter

The formula you have there is saying if either DES Job or EMP Job is blank (I would recommend using ISBLANK() instead there) and Job Status = Work Scheduled then (assuming this is a validation rule) give an error.

 

When you say it isn't working, is it not giving and error when it should or always giving an error? If the error is when you are trying to save the validation rule can you tell us what it is.

LeeCLeeC

I figured it out. Not sure if this is the best way but it works.

 

AND
(
        AND
        (
              (Agreement__r.DES_Job__c = ""),
              (Agreement__r.EMP_Job_Number__c = "")
        ),
ISPICKVAL( Job_Status__c ,"Work Scheduled")
)

This was selected as the best answer
SporterSporter

Yeah so the criteria you wanted was if neither of those fields has a value and the picklist is equeal to Work Scheduled then give an error, I would personally use ISBLANK() instead of ="" but that is down to preference.