Skip to Main Content

Visual Builder

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to display the results of Object Functions on a page?

JohannaBStumpfApr 17 2024

I have two issues where I try to use object functions to get information from business objects. I can write the groovy code and I can test the endpoints successfully, but I am unable to integrate them into the page and display the results. If there are better ways to achieve what I want, I am open to hear them:

1. Display additional information about the currently logged in user:
Situation: I currently show {{'Hi ‘+$application.user.fullName+'!' }} on the front page. I also have an HR business object, that (in theory) contains the names of all users and their supervisors.
Desired result: I want to display “Hi <Username>, your supervisor is <Supervisorname>.”
What I tried: To do that I tried to use objects functions. I managed to write the groovy code that get's the supervisor for the currently logged in username and I can test the endpoint successfully, but I can’t integrate the result in the page. When testing the endpoint returns something like
{
"result": "Supervisorname"
}
I tried to call the endpoint on click of a button, and then display the return, but nothing showed up. Plus, I don’t know how to use the business function in normal display text so it’s just there when the page loads and I don’t have to click a button.
Help needed: How do I call that endpoint and display the result as part of the text on the page?

2. Display additional information in a graph:
Situation: I have a business object that contains a list of events happening at different locations.
Desired result: I want to make a chart to show how many events are happening at which location, i.e. just count how often each location is named in the table.
What I tried: If I just use the quickstart “add data” option I get a #count option for my location objects, but that doesn’t seem to do what I want. Otherwise, I only manage to show the locations and their ID numbers, not the amount of times a location shows up in the table. I again tried to use an object function. Again, I can test the endpoint successfully, but it can only return a string (when trying to return a map, VB stops showing the endpoint - feels buggy), so the result looks like this:
{
"result": "{Location1=2 ,Location2=3, Location3=0, Location4=1}"
}
Help needed: How can I call the endpoint on the page and get that result to show nicely in some type of chart? I tried to use types, variables and custom endpoint data for the chart, but so far nothing I tried had the desired result.

Apropos the object functions feeling buggy: Why is every endpoint created there automatically POST? I am using them as GET. There seems to be no way to adjust that.

Comments
Post Details
Added on Apr 17 2024
3 comments
508 views