You need to sign in to do that
Don't have an account?
Sourav P
Validation rule for the age gap field while editing or cloning
Dear All,
I have a below field, Age main, on a custom object " Quote", The " Main Driver" field is replicating from the account name ( personal account).
The age & other details also get replicate from the account, i.e here the age 23 is maintained in the account " Chimni", But the user have the flexibility to edit the age on the same page or while cloning the page to get a new quote. But i need to set a validation rule where , the user can set only one year gap from the maintained one ( i.e he can edit it as either 23 or 25), it should show validation error if its 22 or 27 etc. If you can help me out in setting. Thnx
I tried to write the below VR but its showing syntax error, and failing.
I have a below field, Age main, on a custom object " Quote", The " Main Driver" field is replicating from the account name ( personal account).
The age & other details also get replicate from the account, i.e here the age 23 is maintained in the account " Chimni", But the user have the flexibility to edit the age on the same page or while cloning the page to get a new quote. But i need to set a validation rule where , the user can set only one year gap from the maintained one ( i.e he can edit it as either 23 or 25), it should show validation error if its 22 or 27 etc. If you can help me out in setting. Thnx
I tried to write the below VR but its showing syntax error, and failing.
(Age_MainD__c) <> OR(PRIORVALUE(Age_MainD__c)+1, PRIORVALUE(Age_MainD__c)-1) Alternatives : Age_MainD__c <> PRIORVALUE(Age_MainD__c)+1 OR Age_MainD__c <> PRIORVALUE(Age_MainD__c)-1
Use less than and greater than. Be careful if you use <> in OR condition because it means union in set theory.
For example, if prior value of the age is 20.
Age_MainD__c <> PRIORVALUE(Age_MainD__c)+1 is {...,18,19,20,22,23,...} (all numbers except 21)
Age_MainD__c <> PRIORVALUE(Age_MainD__c)-1 is {...,18,20,21,22,23,...} (all numbers except 19)
OR of above two set is {...,18,19,20,21,22,23,....} (all numbers)
So it didn't work well.
All Answers
Use less than and greater than. Be careful if you use <> in OR condition because it means union in set theory.
For example, if prior value of the age is 20.
Age_MainD__c <> PRIORVALUE(Age_MainD__c)+1 is {...,18,19,20,22,23,...} (all numbers except 21)
Age_MainD__c <> PRIORVALUE(Age_MainD__c)-1 is {...,18,20,21,22,23,...} (all numbers except 19)
OR of above two set is {...,18,19,20,21,22,23,....} (all numbers)
So it didn't work well.