Question
Empyra.com Inc
US
Last activity: 28 Dec 2017 13:10 EST
Validate only on a condition
Hi,
I have a requirement where I have to validate some properties for "Required" but only on a condition i.e. if another property is true. How do I achieve this?
I created a validate rule which I configured as shown in the image attached. Its not working though. Please let me know a correct way to do this.
Thank you!
***Updated by moderator: Lochan to add Categories***
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
Hi,
In this scenario, you can make use of AND operator.
For example, is .property1==true AND poperty2==null. I would suggest you use both the property by validate rule only & not by Edit-Validate/setting required in property panel for tab.
Please let me know in case of any clarifications.
Regards,
Rachit
-
Rajit Kumar Nookala
Empyra.com Inc
US
Thank you Rachit for the response. Checking for null is something that I did not know. I added the expression like the way you have mentioned in the Validate rule and it doesn't allow me to save. It gives me error.
Pegasystems Inc.
US
Can you try using "" - blank and share the result. In this case, you should not get any error.
Empyra.com Inc
US
This doesnt work either.
-
David Weis
EPAM Systems, Inc.
ES
Hi Hema,
Thanks for posting on PSC.
Rachit has suggested a good implementation way,
Alternatively, how about configuring on the control's cell property as below:-
Sometimes, expression calculation didn't yield the expected result. I have faced similar issue, configure the logic in a when rule and call that when rule as explained above.
Note:- In your case, negate the value in when rule itself.
Hope it helps, kindly notify if it does.
Regards,
Asif
Empyra.com Inc
US
I'm not sure why I chose the other way, this seems to be the simplest way to get it done. Thank you Asif for the response!
Empyra.com Inc
US
I have another condition. I have added these Required Condition to all the controls in the page and the validations get fired once the submit is clicked. I have another requirement to have a button to Restart the Stage. So if that button is clicked and Submit is clicked, the user should be redirected to the first step of the Stage. And this should happen irrespective of whether all the control have value or not. i.e. I want to suppress the Required field validations on Restarting the Stage but they should be active for moving to the next step. Any help on how I can achieve this?
Pegasystems Inc.
US
Hi Hema,
I had tried a sample use case for your requirement in Pega v7.2.2 as shown in attachment. You can have a look into it and try it for your scenario.
Hope this will help you to achieve your requirement.
Regards
Mahesh