Reuse Functionality between Application Modules
Reuse an Element in Another Module
This lesson is part of the Developer Online Class for OutSystems 9 course.

In this lesson we will create a new
eBidding application to register product requests
and supplier bifs. For that, this application will reuse functionality
from the Supplier module. So let's start by creating
a new web application. This will be the eBididing
and let's create a new module
So now I will reuse the same scaffolding patterns we've seen in previous lessons
and I'm going to important an Excel file to create an entity
and to bootstrap data. This will be this requests' Excel file
And I'm going to scaffold
a CRUD over this Entity that was just created
So Request_List, Request_Show
and, Request_Edit
Okay, so let's publish and see what wew have so far
Let me login with admin user, and there we have it
Our eBidding application with the list of requests
There's a product quantity for the product, who is the requester
what is delivery redressed and you can
navigate to a Show page where we see all that information again
and we can edit this information with the CRUD that we just created
Okay now let me go back to
our application and let me just
do a drawing here. What we want to do
is for this request
for this request Entity, so we have a request
Entity we want to create
another Entity where
we are going to register the bids
for that product request. And these bids, so this will be a relationship
for these two Entities. This bids
not also have a relationship with the request entity
they will need to identify which Supplier
placed that. And so there is another relationship here
that we need to create but this supplier
Entity, this is the functionality that we want to reuse
from the Supplier module. So let's see how we do this
To create
this relationship we need to add a reference
to the Supplier Entity. To reuse elements from other modules
we simply need to reference them. This is done
using this window here. The add/remove references window
So let's open the window, and in this window, we will see
all the modules that we have in our environment and we can search for
the supplier. There, the Suppliers module
And if we select this modelule on the right side will see me
the elements that we can reference. But the supplier
Entity is not here
So we need to do something
in the Supplier module in order to be able to create this reference
so let me just cancel this for now and let me go
into the suppliers Module and
what I need to do is on this Entity
I need to set it as Public
by setting the entity as public and publishing these changes
this Entity becomes reusable by other modules
And it will appear on that references window we just saw
Let me published this change. Let's go back to the eBidding application
and let's add the reference. You search for
the Suppliers module
be sure to check that you are seeing
all the modules in the environment. There's also another filter here to only show
the ones that are
in use already, the ones that are referenced already
and if I select here suppliers, now
I see here the supplier Entity and I can reference it
Now I can create my bid
Entity, and this bid Entity, will have an attribute
the request ID
and let me just create here a diagram for us to see what is happening
when I create this entity, so we have a Request
we have a Bid
I also have now
the Supplier entity here there
but this Supplier Entity comes from the Supplier module
and now I can add here
the SupplierId
Okay so this this tells me
that this bid here was done for
this request by this Supplier
and let me just complement here this entity I'll need
another attribute for the price of this bid
And I want to make all these attributes
that's it. Now let's
go back to our screens and let's go back to the Request_Show
and I want to scaffold
the Master-detail list on this request show page
To scaffold the master detail, again I'm going to drag-and-drop
the bid Entity below the ShowRecords
and this creates
the bids list that shows for
which supplier what was the price what was the big prize
that the supplier gave for this product request
I want to do another scaffolding pattern
we we didn't covered this the lessons before
but I showed you that there are more patterns in the Help, and you can search
for this one
The pattern that I want to use and let me use here to search to find that
that object in my application. The pattern that I want to use is the
Info-balloon pattern so let me just search here for
"Info Balloon". There it is
Basically this will create a pop-up
that will show when I hover near this supplier
name, let me just drag-and-drop for us to see, and this will create the pop-up
all the information about this supplier
Okay, so there it is
That was a scaffolding pattern and this created a new
a new screen a pop-up screen. So it has the layout of the pop-up
and it has a ShowRecord with all the information about the supplier
so we're all done. Let's publish and see
the eBidding application
Here we have our eBidding application again. Let's choose this first request
and let's create
now we have here in the Master-detail list. Let's create a bid
and let's say that this is for
Abbott Laboratories and the price is
224, for instance same
so there we have it. And here
is the Info-Balloon, with all the information
about the supplier. So let me just go back here into my application
Let's just review
what we did in this lesson
In this class in we created the ebidding application
and we added a module
to this application, the eBidding module
in the previous lesson
we had created the Suppliers application
that has also a module, the Suppliers module
and on this module
what we did in this lesson was that we went through
and set
the Supplier Entity
we set the Supplier Entity to be Public
and when we made this public we were
able to create a reference between these two modules
let me just finish this
diagram. This is a Suppliers application
So we created reference between these two modules
and now the eBidding application is dependent
on the Suppliers application. And that's it.