Showing results for 
Search instead for 
Did you mean: 

[SAP MDK] Saving data in a GLOBAL variable/context and accessing it from a different rule

0 Kudos

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:

  • A single page contains two buttons, each with their own rules for the "onPress" events
  • The 1st rule would store the result from an API call (OData/REST)
  • The 2nd rule, triggered separately, would access this stored result to perform specific operations on it (read, update, etc.)

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.

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);


View Entire Topic
Product and Topic Expert
Product and Topic Expert

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.

0 Kudos

Tausend Dank Bill  🙏

For those encountering the same "challenge", here's a short/direct guide:

  • To create and set a new property (variable) -here "NewProp"- within the "global container" ClientData , you would write the following:


context.getPageProxy().getClientData().NewProp = "New"​​


  • To read the value from this newly defined property, use:


let newLocalVar = context.getPageProxy().getClientData().NewProp;​