cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

get variable from js to backend n the Kiosk Mode ( Quick service)

xsalgadog
Participant
0 Kudos
248

good morning,

How can I get the value of a variable from my js code in the backend, in the Kiosk Mode ( Quick service)?

Accepted Solutions (1)

Accepted Solutions (1)

R_Zieschang
Contributor
0 Kudos

Dear xsalgadog,

you need to send the input value into the eventbus through the plugin event channel.

this.pluginService.backendPluginEvent('MY_PLUGIN_EVENT', {
    'myData': inputModel.getValue()
});

In your plugin (java) backend you need to implement a listener:

BroadcasterHolder.INSTANCE.addEventChannelListener(new UIEventChannelListener() {
  @Override
  public void handleEvent(String eventId, JSONObject payload) {
    if(StringUtils.equals(eventId, "MY_PLUGIN_EVENT")) {
      System.out.println(payload.getString("myData"));
    }
  }
}

hth

Robert

Answers (3)

Answers (3)

xsalgadog
Participant
0 Kudos

thank so much!

R_Zieschang
Contributor
0 Kudos

You are welcome!

xsalgadog
Participant
0 Kudos

from the js code how can I send what the text field captures to the backend?

Thank you.

R_Zieschang
Contributor
0 Kudos

Dear xsalgadog ,

you may push an plugin event into the eventbus and implement a handler in your plugin backend.

See https://answers.sap.com/questions/12901101/example-for-a-quick-service-plugin-cco.html?childToView=1...

as an example.
If this helped please kindly select my answer as the correct one as it may help other.

Regards

Robert