Home > Forum > Rules, JS, SQL > uxContext missed in version 2022

uxContext missed in version 2022
0

Hello Everyone,

Recently, we upgraded Webcon from 2021 version to 2022 version. New version 2022.1.4.326.

I have this html content in one of HTML field in Webcon:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<a id="RabenCopyToClipboard"><button id="CopyClipboard" class="btn btn-md hide-on-sidebar-dash"
onclick='
Promise.all([window.webcon.businessRules.executeBusinessRule(12909, "ClipboardRule", uxContext, {})]);
document.getElementById("RabenCopyToClipboard").remove();
return;
'><i class="fa fa-copy"></i></button>
</a>

the purpose of this is to run bussinessRule.
But in new version it looks like there is no uxContext

function executeBusinessRule(ruleId, ruleName, uxContext, params) {
let formModel;
let formInfo;
window.Injector.resolve(['ModelController', 'FormInfo'], function(modelController, form) {
formModel = { ...modelController.getDataModel(), uxRuleParams: params };
formInfo = form;
});

i got error:
view?returnurl=%2Fdb%2F1%2Fapp%2F68%2Freport%2F225:2 Uncaught ReferenceError: uxContext is not defined
at HTMLButtonElement.onclick (view?returnurl=%2Fdb%2F1%2Fapp%2F68%2Freport%2F225:2:86)

i checked also console.log(window.uxContext) - it is the same situation.

Do you know how it was changed and maybe how to replace it ?

MVP

Hi Michal,

In my opinion you can just pass an own uxContext object as a parameter.

1) I created a form rule
2) Which executes a business rule
3) I invoked the form rule via a button in an html field. The debugger; statement allowed me to break the code execution when the developer tools are open.
4) The form rule generates or "updates" the uxContext which is passed to the business rule.
The uxContext object in this case is nothing more than:
{
parameter: []
}


You may encounter a lot more situations like this when updating to BPS 2023+. Even so this feels like advertisement you should check out this post.
https://daniels-notes.de/posts/2023/updating-to-bps-2023

You could already prepare your processes for BPS 2023+.

Best regards,
Daniel