Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In dashboards there is a similar functionality which can execute the REST call from a button in a portlet without the need to configure the bound partition.


Code Block
languagegroovy
def payload = api.jsonEncode([
            "data"     : ...,
])
def ctrl = api.newController()
ctrl.addBackendCall(", "add/X", payload, "Record was created sucessfully", "Could not create record")
return ctrl


The drawback of this solution is that the REST call is not done during the logic run, but when the user clicks the button. On the other hand, the benefit is that you don't do not have to configure the bound partition, which is often "localhost".

...