Reuse Functionality between Application Modules
Debug Reused Logic
This lesson is part of the Reuse Functionality between Application Modules course.
LEARN MORE

Transcript
In this lesson we will create a Public action in the Suppliers application
and reuse it in the eBiddings application
we will see how we can be debug this action
in the context of the eBidding application so let's go into
the Suppliers application again, and I want to create
and action here that will
RegisterSupplierActivity and to register the supplier activity we will need
to have a couple of input parameters like
the SupplierID and
a Description. And to implement the logic for this action will need another
local variable that will be the
SupplierActivity record, and
I'll need to assign to this record the values from the input parameters
So let me select here the variable. This will be
the SupplierId
this will be set to the input parameter of the action
and next we will set the description
We don't need to set the Instant, because the Instant has a default value
CurrentDateTime(), so let me select here the description
and send it to use the input parameter
Let me just close this
to get some space I'll need to use the Entity action
to create
to create the SupplierActivity and I'll need to
fill in the source parameter with the variable
And we're all set for the logic all I need to do now
is to make this action Public so that we can reuse it
in the eBidding module. So let me publish
and now
let me open the eBidding module in the eBidding application
and to use the action
first we will need to create a reference to this action that we just created
So let me open the Add/remove references
and left search for the action so it's in the Suppliers
module, there and this is the action that we want
Okay
What we want to do with this action we want
that every time that we create
a new bid for a supplier we register
that event through this action so we'll have to go here in the interface
to the PopUpEditor that creates
in the save action that creates the bid
and I want to know
Let me just get some space here
I'll select all these elements and
let me get some space in here
If this is a new bid
So let me add the logic here, if this is a new bid
then we are going to use that action here
so let me drag here the execute action and
action that we want to use the register this one
RegisterSupplierActivity
Sp let me just connect here
these nodes, let me put the condition for the IF so
if this is a new bid
meaning that the bid identifier is NULL
if this is a new bid
I want to execute this action and now I need to fill in this parameter so
the supplier ID will come
from the EditRecord and we need to fill in
the description. And for description I want to include
the product that is on the request so I'll need to
get this request so I'll use
this parameter here on the screen
to get the request I'll put this query in the True branch
and now I can fill in this description
so this will be something like "This supplier
placed a bid
for", and
now the product that is on the request.
So that's it, we're all done. Now I want to publish this
and I want to test my application. So first of all let's publish
And, I want to test this application but I want to debug
this action. In other words let me go here into the suppliers
I want to debug this RegisterSupplierActivity
so let me add here a break point and
to the debug this action reused in the eBidding application
we need to set the eBidding module as the starting point
for the user interaction. And to do this
we will use and option here on the Menu
that is this one "Select Entry eSpace"
and now I can select here
the eBidding module
So let's start the debugger here on the Suppliers module
You notice that this here now says "Debug
eBidding in the public area"
we are actually debugging this action in the context of the eBidding application
and let's go back here to the eBidding application
and let's open the eBidding application in the browser
Okay, so let's go into this first request and let's
place another bid and for
this second Supplier here with another price, let's say that this
is 243, save
and you'll notice that
nothing is happening here and this is because, let me just
change back here this is because we are stopped here at the break point
and you'll notice here on this on this tab
that we are actually debugging a request that comes from the
eBidding module and somewhere
in the save action that is on this pop-up
calling the RegisterSupplierActivity
and we are passing these parameters to this action
so this is the way for us to debug this action. Let me just
Step over here and
we'll assign the values to the local variable
and then we're going to create the SupplierActivity
We're all done, the request is over. If you go back to the browser
There we have it, the bid was successfully created
now if we go, let me just switch again here,
if we open the Suppliers application.
If we go into the Show page of this supplier
we will see
the information that was stored through this
action which is Public and we reused
in the eBidding application. And that's it