Correct me if I'm wrong but business rules are acting in back office, protecting your database against unwanted actions. Doing this with javascript will just do some stuff in the client side, so it is not really secure, right ?
You're partially correct. Business rules can be applied at the entity level, yes. However, in this case, we're comparing against business rules applied at the form level, not the entity level. You could add JS to perform actions prior to the record being created or updated, which would prevent the data from being entered to/modified on the entity, but I wanted to stick to the topic at hand for this video and not get too deep into the weeds. Thanks for watching!
Intriguing ( and entertaining) presentation. I do like the way the code is constructed and also passing parameters in the field properties. Does the anonymous function in the beginning get called just once on load , if so could this provide state such as global array variables in the browser session ? If wanted to call the functions in the JS file from say a form.js attached to a main form , is this possible, say in the way you declare your functions.
Correct. Though the function is technically anonymous, the script is connected to the window. The script is called on Load, but no actions are performed that are not attached to the on load event. Calling PWLowToPro.* from another resource (as long as they're both connected to the form), would still call these functions. As for global variables, it's possible to use executionContext.setSharedVariable() to set a variable that can be passed between handlers. As a note, any files linked to a form are loaded simultaneously, so you'd need to handle the potential for an exception or an error being thrown at load.
Correct me if I'm wrong but business rules are acting in back office, protecting your database against unwanted actions.
Doing this with javascript will just do some stuff in the client side, so it is not really secure, right ?
You're partially correct. Business rules can be applied at the entity level, yes. However, in this case, we're comparing against business rules applied at the form level, not the entity level. You could add JS to perform actions prior to the record being created or updated, which would prevent the data from being entered to/modified on the entity, but I wanted to stick to the topic at hand for this video and not get too deep into the weeds. Thanks for watching!
Intriguing ( and entertaining) presentation. I do like the way the code is constructed and also passing parameters in the field properties. Does the anonymous function in the beginning get called just once on load , if so could this provide state such as global array variables in the browser session ? If wanted to call the functions in the JS file from say a form.js attached to a main form , is this possible, say in the way you declare your functions.
Correct. Though the function is technically anonymous, the script is connected to the window. The script is called on Load, but no actions are performed that are not attached to the on load event. Calling PWLowToPro.* from another resource (as long as they're both connected to the form), would still call these functions. As for global variables, it's possible to use executionContext.setSharedVariable() to set a variable that can be passed between handlers. As a note, any files linked to a form are loaded simultaneously, so you'd need to handle the potential for an exception or an error being thrown at load.