- 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:56 PM
Hi Muhammad,
Really thank you for your effort. I have mentioned 2 fields, just for an example, I have close to 8 fields.
For all the fields nested if will not be a right choice I guess.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-01-2022 01:59 PM
No worries,
In your UI policy condition you are using as "Status" greater then or is "Assess". I am not sure this is going to work.
You should use it like status is Assess (or Access).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-01-2022 02:18 PM
Hi Muhammad,
I have tried that as well. But issue is not resolved.:-(
Thank you
- 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:44 PM
Hi Harun,
Thank you.= for sharing
If the user didn't Fill the test_plan then I need the error message as "Please fill the test Plan"
Above one is standard error message. Error message needs to be changes based on the filed not filled. Please help