Make field mandatary based on another field changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 01:22 AM
i have 2 fields in the Program table. 1. Employee 2. Portfolio.
my requirement is for new record, employee field is mandatory,
after saving the form if we change the value in Portfolio then the employee field is not mandatory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 01:37 AM - edited 01-23-2024 01:38 AM
Hi @VSN ,
if you need to Onchange client script Portfolio is behavior like Onchange as well as onload -:
do the simple change in if condition remove the isLoading ||
eg.
function onChange(control, oldValue, newValue, isLoading) {
if ( newValue == '') {
if(g_form.isNewRecord()){
g_form.setMandatory('employee',true);
}else if(oldValue!=newValue){
g_form.setMandatory('employee',false);
}
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 01:40 AM
Hi @VSN
You an make it on load client script or UI policy.
May i know the reason why you dont want it to make mandatory after save, you can make it read only if all good.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************