Created
December 19, 2024 12:28
-
-
Save AshikaSuresh/e2e0a8fb7f48ec5655dfd46be426f078 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| If the Allocated Budget of all campaigns exceeds the Total Budget Allocated, prevent the row from being saved and display an error message. | |
| Prevent row save on criteria mismatch: Use beforeRowUpdate subform event to return false and display an error with showError(). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var total_budget = ZDK.Page.getField('Total_Budget_Allocated').getValue(); | |
| log("Total Budget :" +total_budget) | |
| var subform_length = ZDK.Page.getSubform('Campaign_Details').getValues().length; | |
| var total = 0; | |
| for (var i = 0; i < subform_length; i++){ | |
| var allocatedBudget = ZDK.Page.getSubform('Campaign_Details').getRow(i).getCell('Allocated_Budget').getValue(); | |
| var audience = ZDK.Page.getSubform('Campaign_Details').getRow(i).getCell('Expected_Audience_count'); audience.getValue(); | |
| log('Allocated budget : ' + allocatedBudget) | |
| log('audience count : '+audience) | |
| total = total + allocatedBudget; | |
| } | |
| log('Total : ' + total); | |
| if (total >= total_budget) { | |
| ZDK.Page.getSubform('Campaign_Details').getRow(index).getCell('Allocated_Budget').showError('Budget exceeds the total budget allocated'); | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment