Pass the record on the next screen with REST API

Hi, I am new in Outsystems platform. I am exploring how to display Employee records using consume REST API.

before that, here is the link of my API: http://www.mocky.io/v2/5e6a0c1e2d000093005f9fbc

What I wanted is whenever I clicked one of the records in the employee list like this picture,


I will get into the other screen with the details of that Employee. But right now I was able to get the response from the API but it always shows the first record or the record 0


Can someone teach me how to do it properly? I've been searching the whole day but can't find what I wanted. Thank you in advance.

Hi Robert,

I think you are using current object of the list to get the data that is why you are getting date from the record fo the zero index only. Also to pass complete employee data object to other screen you can set it in session variable and access this seccion on the other screen.

Please fin attached sample for your reference and ignore the styles :)

Hi Robert,

Yes, there should be no issue in using service module. You just have to use your service action when I am calling REST API method in my sample. Other then that everything will work same as per the sample I have provided.

I will try to check your application later.

Nikhil Gaur wrote:

Hi Robert,

Yes, there should be no issue in using service module. You just have to use your service action when I am calling REST API method in my sample. Other then that everything will work same as per the sample I have provided.

I will try to check your application later.

Thank you this is my application. I hope you'll help me figure out where in my application I am lacking or doing it wrong.


PS. My application is a Reactive Web App. I can't find how to implement the session variable in RWA.


Solution

Hi Robert,

I tried to implement your objective as a sample application.


PFA - Includes both 

1) Sample Solution in Traditional Web (.oml) - https://sbsam.outsystemscloud.com/MockyApp/

2) Sample Solution in Reactive Web (.oml) - https://sbsam.outsystemscloud.com/MockyReactiveApp/


Important Point: Don't pass record type value as screen input parameter, instead pass something unique Identifier value as an input parameter. for e.g. in this case, I passed UUID value as an input parameter to the Detail Screen.



Please let me know, if you need any more help.

Hope this helps you!


Thanks & Regards,

Benjith Sam

Solution

Hi Robert,

What you have is a classic pattern of Master-Details screen design.

On selection of a record in Master, you need to get the Unique Identifier of the Record. example, for Employee record, you may have Employee.Id, where Employee is name of your entity / or REST response structure.

In your case uuid of the employee record.


Then pass the unique identifier to your Details screen, and perform another fetch to get the details record. using the uuid.

Regards,

Saugat



Robert Braxton wrote:

Nikhil Gaur wrote:

Hi Robert,

Yes, there should be no issue in using service module. You just have to use your service action when I am calling REST API method in my sample. Other then that everything will work same as per the sample I have provided.

I will try to check your application later.

Thank you this is my application. I hope you'll help me figure out where in my application I am lacking or doing it wrong.


PS. My application is a Reactive Web App. I can't find how to implement the session variable in RWA.


With reactive you can not use session so in this case you have to fetch details again based on the passed employee id.

Please find attached sample for service and reactive web apps. In this case you should create two different APIs for employee list and employee details and consume them accordingly.


THANK YOU EVERYONE :)


I achieved what I wanted to do. Thanks for helping me guys.