Structure Pages with Reusable Elements
Add Logic to Reusable Page Elements
This lesson is part of the Developer Online Class for OutSystems 9 course.

In the previous lesson we saw how to implement reusable screen parts.
Now we will customize those parts depending on the context they are being used in.
This allows to reuse the same element that provides some degree of customization.
What we'll do is to have, is to first change here this issue list and this will be
the high priority issues and what we'll do is to create several list of issues based
on their priorities. So let me change here also the title "High Priority" and also
here the title on the page, and this will be the "High Priority Issues".
And let me just here add a new web screen for the "Low Priority Issues",
set the anonymous role, low priority issues and let me add here also the issues
which I forgot issues and here on the page this will be the Low Priority Issues and
we will reuse the webblock with the issues and later we will customize this and let
me just add the web screens to our menu so we can reach all these pages.
So let me add here the high priority and now the low priority.
Okay, and let me also remove this preparation that we added in the previous lesson
for the debug, we don't need it and there's one, one other list that we're
going to have which will be the unclassified issues. So again set the anonymous role
here, unclassified issues, and let me set here the title, "Unclassified Issues".
Add the page to the menu, add the webblock here to the page,
and let me just customize here the menu so that the unclassified is the first option
on the menu. So I will double click here the menu and select here the menu webblock
and move it to the first place. Okay, and so this is the high priority,
this will be the low priority and this will be the unclassified.
What we need to do now is to change also the default entry point to now we won't
let me move here the unclassified, we want the homepage to go to the
unclassified and let's publish and see our data. Okay, so here we'll have the
unclassified issues then we can have here the high priority but as you can see we
have here always the same information. If you go to the low priority,
we have always the same information on this table records so we need to customize
our webblock. You can have multiple instances our webblock being used in several
pages so the users can not reach directly the webblock they need to be intantiated in
pages and now we need to customize it so that it shows different information based
on the context that are being used. And to do that I am going to create a static
entity first to for classifying my issues with priority so let me go ahead here and
create a static entity with the priority and this will be high and low.
Let me add a new attribute to the issues with the priority so issue with the
priority ID. Okay, and now to customize this I will need to go back here to the webblock
and add an input parameter to this web lock, which will state which priority
to prioritize ID, and this will say which priority I am going to use to show the
issue so here. Let me go ahead and use this attribute, this input parameter as an input
parameter to my query and I want to have the issues with priorities equal to that.
And now we need to fix here some errors because we are using that webblock in three
places as you remember so we have three less we are using. On the unclassified we
want to show the issues that don't have a priority so the priority ID here will be
null identifier. And let's go back here on the high priority we want to show the
issues that have the high priority value and finally on the low priority we want to
have the issues that have low priority. Okay, so we customize our webblock with a
input parameter. This is pretty much what we would do in a web screen so you can
also have input parameters in our webblock. We passed a different balance let's
now test our application to see if we have different information in our
pages. Okay, so now on the unclassified we have all of the issues because they don't
have any priorities set yet. On the high priority we no longer have any issues
because now we'll need to implement the logic to set this priority to the issues and
also on the low priority we also don't have any information.
Okay, so this is, this is how we customize the logic of reusable screen part.
That's it.