Empty set After Bonita REST api is used

1
0
-1

ok as requested i create a new Question

Here we go. Now it looks like this , i have written the API using the maven REST api extension i used it like this

b.png

Now the API converted to JSON here and the JSON looks like this :

[
    {
        "id": 1,
        "fullname": "Emeka Iwuagwu",
        "perdiem": 4500.00,
        "supervisorname": "James Hall",
        "supervisoremail": "jameshall@***************.com",
        "userid": "101"
    }
]

Having looked at it i made the API into a variable and used in the value like so :

g.png

Now the information populates on the form now like this

t.png

Now after filling the form, other than show the data entered into the form, it posts empty like this

k.png

What did I miss?

Comments

Submitted by antoine.mottier on Thu, 05/23/2019 - 18:47

What is the value of the "Data sent on click" property of the submit button widget?

Submitted by raysoniali on Fri, 05/24/2019 - 09:08

FormOutput as is shown below

screenshot

Did i miss anything?

1 answer

1
0
-1

In your form, the input widget value is configured to be stored in a form variable named peopleInformation and the submit button is configured to send the data stored in formOutput. So based on the information you shared there is no way that the data provided in the input will be sent to the process and stored in the business variable.

You have to option to fix that:

  • use a unique variable for both your input widget "value" property and for the submit button "data to sent on click" property.
  • for the submit button "data to sent on click" property, use a JavaScript variable with a value set using the peopleInformation form variable. In the JavaScript code used to initialize a form variable you can access other form variables using $data, e.g. $data.peopleInformation.

Side note: there is a two way data binding between the widget and the form variable: form variable will be used to set the widget initial value and when value is edited in the widget the variable value is updated.

Comments

Submitted by raysoniali on Fri, 05/24/2019 - 10:35

i put it back to use the API to fetch the information from the REST and display on the form input widget controls then it did like as i showed in the image above and still it sends empty result sets to the DB this is currently what I have in the formOutPut

3333333.png

I still wonder why it gives the zero input on the H2 DB, does not signal any errors , but saving empty into the DB

Submitted by raysoniali on Fri, 05/24/2019 - 11:00

Here is my link to the Project. you can have a view of it again https://drive.google.com/file/d/14gZsZZY6IFBGQOto1DNStQSzDdGYusg0/view?u...

Submitted by antoine.mottier on Fri, 05/24/2019 - 11:49

Your process contract is expecting only a complex data named travelRequestInput so there is no way that it will use or store the information provided in peopleInformation.

Make sure that the JSON sent when submitting the format match the contract definition.

Submitted by raysoniali on Fri, 05/24/2019 - 11:58

Uh, that is to say it cannot submit the data for the REST api data converted to json , isnt it?

Submitted by antoine.mottier on Fri, 05/24/2019 - 12:01

Please share the content of the HTTP POST request sent when you clicking on the submit button. See how to view it using Firefox here: https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor/request_d...

Submitted by raysoniali on Fri, 05/24/2019 - 13:13

I did as you said even inside POSTman and its not returning any results.

Submitted by antoine.mottier on Fri, 05/24/2019 - 14:55

You should not look at the response from the server as you want to see the data being sent from the form to the process. You should look at the data in "Params" tab (Firefox), "Headers"->"Request payload" tab in Chrome.

Submitted by raysoniali on Fri, 05/24/2019 - 16:07

there has been some difficulty of some sort here as when i click the button, it redirects immediately

i see a URL like this http://localhost:8080/bonita/portal/resource/process/LocalTravel%20Reque... i was able to capture but when i click it does not show the contents.

I am really lost here. TBH i just need a hand about these things

Submitted by antoine.mottier on Fri, 05/24/2019 - 16:11

Can you share me a screenshot of the params tab of Firefox? Read the following documentation to know how to use the Firefox network monitor: https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor/request_d... You can find similar documentation for Chrome: https://developers.google.com/web/tools/chrome-devtools/network/

Submitted by raysoniali on Fri, 05/24/2019 - 17:21

Sorry for the late response.

oj.png

Submitted by antoine.mottier on Mon, 06/03/2019 - 19:33

I need a screenshot of the HTTP POST request sent when submitting the form. In Chrome developer tools you should see the data in "Network" -> "Headers" -> "Request Payload".

Notifications