2 weeks ago
Hello MDK Community,
Is it possible to save and read data in a "global" variable/context (e.g. through a rule/action) and access it from a different rule?
Let's consider the following scenario as an example:
I want to emphasize that the goal is not triggering the rules consecutively (i.e., it's not about chaining one action with another action/rule).
My question is, how can I store the data/result of the first call in a global or "application-level" variable/context, and then access this variable from the separate rule?
Thanks in advance.
Khaled
I have already attempted to retrieve the result using "getActionResult" in the 2ndrule, but I receive "undefined":
let actionResult = clientAPI.getActionResult("/SampleMDK/Actions/ReadOdata.action");
console.log('actionResult: ', actionResult);
For temporary storage I would recommend using ClientData. I would probably use context.getPageProxy().getClientData() and store my result there. If the data needs to still exist after the page is closed you can use getAppClientData() to get the application level client data.
Please remember that client data is cleared when the app is swiped closed or new definitions are loaded from App Update.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tausend Dank Bill 🙏
For those encountering the same "challenge", here's a short/direct guide:
context.getPageProxy().getClientData().NewProp = "New"
let newLocalVar = context.getPageProxy().getClientData().NewProp;
User | Count |
---|---|
68 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.