You need to sign in to do that
Don't have an account?
chopair
Cross Objects validation rule
I have a custom object (Service Request) has a master detail relationship to the Case object. What I am trying to do is to prevent a user from closing a case if the related service request record does not have a status of "awaiting invoice" This status field in my custom object is a picklist. This is the code that I have attempted to enter and the error message I get when I try to validate it.
Rule:
AND(ISPICKVAL( Status ,"Closed - Resolved"), NOT(ISPICKVAL ($ObjectType.Service_Request__c.Fields.Status__c, "Awaiting Invoice")))
Error:
Incorrect parameter for function ISPICKVAL(). Expected Picklist, received Object
Any help/suggestions would be appreciated.
Rule:
AND(ISPICKVAL( Status ,"Closed - Resolved"), NOT(ISPICKVAL ($ObjectType.Service_Request__c.Fields.Status__c, "Awaiting Invoice")))
Error:
Incorrect parameter for function ISPICKVAL(). Expected Picklist, received Object
Any help/suggestions would be appreciated.
sfdcfox
You can't use formulas for validations across objects right now, excepting the use of Roll Up Summary formulas. You'll need to use Apex Code if you want to cause this to work as expected. See the relevant feature request.
chopair
Thanks for letting me know.
sush
Or else you can assign an S-control to Close Case Button.
In S-control you have to retrieve the related records for a case and check the staus value.If status is 'Awaiting' throw a erroe msg saying 'case cannot be closed' and redirect back to case page.Else redirect to Standard case close page(If all the related records are closed).This is very simple.
chopair
Since you can't add an s-control to the close page layout, how would you get the s-control to fire when someone goes to close the case?
sfdcfox
Bit late on this reply, but the answer is not to place on the close page layout, but override the button itself. Setup | App Setup | Customize | Cases | Buttons and Links. Choose the Override option for Close Case, and there you have it. Example S-Control follows.
Code: