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
Danny@ReachLocalDanny@ReachLocal 

Incorrect parameter, expected Object

Good morning,

 

Trying to create a validation rule pulling from the Case object as well as two custom objects (Agency Input Task and Collaboration Task)

 

(ispickval (Status, "Resolved")  || ispickval(status, "Closed")  || ispickval (status, "Denied")) &&  ($ObjectType.Agency_Input_Task__c.Fields.Completed__c  =  false) ||  ($ObjectType.Collaboration_Task__c.Fields.Completed__c = false)

 

so basically if either an Agency Input Task or Collaboration Task is not complete (marked by a checkbox)(boolean) then the Case cannot be resolved/closed/denied. 

 

But the fields from the custom objects seem to be returning an error:

Incorrect parameter for operator '='.  Expected Object, received Boolean

 

does anyone know how to correct this?

 

thanks

dtravellerdtraveller

I don't think you can traverse relationships to other objects in validation rules.

sfdcfoxsfdcfox

You can't use $ObjectType this way. Traverse the relationships by going through the relationship names (__r instead of __c, and see documentation or system UI for standard fields).

 

Your code should probably look something like this:

 

 

AND(Case( Status ,"Resolved",1,"Closed",1,"Denied",1,0)=1,
NOT(AND(Agency_Input_Task__r.Completed__c,Collaboration_Task__r.Completed__c ) ) )

Use Case for multiple values on a selectbox that should be one of several values. Better performance, less code space used. Switched A || B to !(A && B), slightly better comparison rate, and better reflects your logic (this says that only when both boxes are checked, would the result be allowed). " = true" and " = false" is not necessary for checkboxes; simply use their name for true, or NOT(fieldname) for false.

 

Let me know if that fixes your problem.

 

Danny@ReachLocalDanny@ReachLocal

thanks for your help.  Still gettingan error on the custom object, :

 

(NOT(OR(Agency_Input_Task__r.Completed__c, Collaboration_Task__r.Fields.Completed__c )))

 

stating that the field Agency_Input_Task__r does not exist.  (Agency_Input_Task__r is the custom object, Completed__c is a field on the object)....

 

any suggestions would be apprciated..

 

 

sfdcfoxsfdcfox

Use the insert field button to get the correct name. Agency_Input_Task__r is the name of the custom field that points to your object, not the object's name.