Hi everyone,
experienced BPS Designers will remember a time when form rules didn't have an 'Edit mode', where you could select JavaScript or Form rule. You only had JavaScript. :)
In the meantime the 'Form rule' option has been added an the JavaScript mode gets little attention, if at all. But how can you do some of the 'Form rule' actions with pure JavaScript? If you click on the "Show" button in the expression preview you will the JavaScript representing the graphic rules.
In my case I wanted to execute a 'Form Rule' which again does some more stuff. Unfortunately the id of the rule is added to the name which again is used as a function name. Since the id depends on the environment it gets a little annoying. If you don't want to use a constant which stores the ids, you can use the following approach:
for( prop in window) {
if (prop.startsWith('UxRule_TTriggerMenuActionTCreateMeasure_')) {
window[prop](); // can be expanded if necessary as shown in the preview.
break;
}
}
Best regards,
Daniel