cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the context object from selectionproxy in mdk?

0 Kudos

Hi,

I want to get the context object from selectionproxy in offline mode, can you please tell me the way to get it?

Thanks & Regards,

Accepted Solutions (1)

Accepted Solutions (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

For Table controls where you are creating a rule in the OnPress event the selected object can be obtained with the following call in your rule.

let selected = context.getPageProxy().getActionBinding();

This is applicable for all MDK applications both online and offline.

Answers (2)

Answers (2)

0 Kudos

Thanks Bill

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

All rules are passed the current context as the input parameter to the rule. You can name the input parameter anything you want or just generically call it context.

export default function myRuleName(myRuleContext) {

The proxy type for that context will depend on where that rule is being executed from. For example, a rule running from the Action Bar would have a Page Proxy context while a rule executing in the OnValueChange of a control will have a different context.

In some cases you may to access the proxy for a different control. To get that proxy you can context.evaluateTargetPathForAPI(path) and pass in the target path. The path could be #Control:MyControlName or #Page:Main/#Control:MyOtherControl and the function returns the proxy object.

0 Kudos

Hi Bill,

I have given the rule for objecttable press event, with the context while using binging, getBindingObject(), it is returing undefined,i want to get the bindingobject of the pressed record, could you please help me?.

Thanks in Advance