- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-01-2022 01:17 PM
Hi
I am creating Business rule for Change request form. while moving the status new to access, we have few mandatory fields.
If the mandatory fields are empty then it should show the error with the field name.
For Ex: If the user didn't Fill the test_plan then I need the error message as "Please fill the test Plan"
below one is standard error message. Error message needs to be changes based on the filed not filled. Please help
(function executeRule(current, previous /*null when async*/) {
if (current.implementation_plan.nil() || current.test_plan.nil()){
gs.addErrorMessage('Please fill the implementation plan and test plan');
current.setAbortAction(true);
}
})(current, previous);
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-01-2022 01:35 PM
Mandatory fields will be highlighted by default and prevent record submission/update if they are empty. The business rule is unnecessary. But if the customer is pushing it for whatever reason try this:
(function executeRule(current, previous /*null when async*/) {
if (current.implementation_plan == null || current.test_plan == null){
gs.addErrorMessage('Please fill the implementation plan and test plan');
current.setAbortAction(true);
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-01-2022 01:30 PM
Hi SD,
Why are you looking for custom way of implementing this OOTB feature?
If we do not provide any mandatory field then we will get Error Message representing one or more fields.
Hopefully, you will get my point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-01-2022 01:40 PM
Hi ,
We have already write a UI Policy for Mandatory fields.
I am writing the business rule, Because when ever network slowness is happening UI Policy is not Working. Which is Bypassing the condition and save the form.
Hence Writing a custom BR.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-01-2022 01:44 PM
Can you share screenshots of UI policy ?
Well, if you still want to create a BR then it should be like this.
(function executeRule(current, previous /*null when async*/) {
var result = false;
if (current.implementation_plan.nil() && current.test_plan.nil()){
gs.addErrorMessage('Please fill the implementation plan and test plan');
result = true;
} else if(current.implementation_plan.nil()){
gs.addErrorMessage('Please fill the implementation plan');
result = true;
} else if(current.test_plan.nil()){
gs.addErrorMessage('Please fill the test plan');
result = true;
}
current.setAbortAction(result);
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-01-2022 01:52 PM
Hi,
I have added the fields in UI Policy, It is working When the normal flow is happening.
I have tried with onload and without onload options. but when the network issue happening users are submitting the form before it is loaded. then it is bypassing the rule and moving to the next stage.