-3

create a validation rule on Org_c object that fires when: if Account.Name = 'Joo' and org_credential_r.name is changing to 'AAT-AAT' and Approval = true and 'Priority' NOT Equal to 'High'.

Pls exclude user sharan G

Account.Name = "Joo" &&
ISCHANGED( Org_Credential__c) &&
Org_Credential__r.Name = "AAT-AAT" &&
Approval_c= TRUE &&
TEXT( Priority) <> "High" &&
$User.Username <> "[email protected]"

I tried the above formula, its not triggering the validation rule please help

12
  • 1
    Welcome to Salesforce Stack Exchange (SFSE). What happens if you only try one of those at a time? Which one (if any) fails to work as expected?
    – Moonpie
    Sep 21, 2021 at 14:45
  • ISChanged is bit confusing - whenever user checks Approval_c, and saves the record and then he again changes the org_credentail to AAT-AAT, its not throwing the error message, though he meets all the other conditions
    – Harish
    Sep 21, 2021 at 14:53
  • You have connected 6 criteria with AND - that means that ALL of those criteria must be met EACH TIME the record is saved in order for it to fire. If a user makes some changes and saves, then makes other changes and saves again, this one rule will not fire.
    – Moonpie
    Sep 21, 2021 at 14:59
  • Can you please suggest or provide the rule which meets all criterea
    – Harish
    Sep 21, 2021 at 15:04
  • AND( Account.Name = 'Joo', ISCHANGED( Org_Credential__c), Org_Credential__r.Name = "AAT-AAT", Approval_c= TRUE, TEXT( Priority) <> "High", $User.Username <> "[email protected]" ) Can i try this? i wanted to know the main difference of tis and the initial formula( question Posted)
    – Harish
    Sep 21, 2021 at 15:21

1 Answer 1

0

Your validation rule fails because ISCHANGED() cannot reference fields on other objects, You can complete this task by creating a checkbox field on org_credential object and a workflow rule to update checkbox field when name changes.

Follow these steps:

  • -Create a checkbox field on org_credential object. -Create a workflow rule set the Evaluation criteria to created, and every time it's edited. -In Rule Criteria select formula evaluates to true. -In Rule Criteria body enter ISCHANGED(Name). -Click Save&Next. -Click Add Workflow Action. -Select New field Update. -Enter name and Unique name. -Select the checkbox field in Field to Update. -Select true in Specify New Field Value section. -Click save and then Activate.

And then Update your formula field by this formula:

(Account__r.Name = "joo") &&    
(org_credential__r.OrgCredNameChanged__c = true) &&
(org_credential__r.Name  = "AAT-AAT")  &&  
(Approval__c = true)  &&  
TEXT( Priority__c) <> "High"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .