0% found this document useful (0 votes)
14 views10 pages

Error Log - Common Errors Exercise

This document describes how to troubleshoot common errors in an Orders application. It outlines steps to investigate errors by searching the service center, analyze error details and stack traces, understand the root cause, and consider options to fix errors. Specifically, it addresses an internal error when getting customer data with a null key, and an unexpected feedback message when saving a new order product without passing the required order ID. The recommended fixes are to check for null keys before database calls, and pass the order ID as an input when saving related records.

Uploaded by

Carlos Junior
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views10 pages

Error Log - Common Errors Exercise

This document describes how to troubleshoot common errors in an Orders application. It outlines steps to investigate errors by searching the service center, analyze error details and stack traces, understand the root cause, and consider options to fix errors. Specifically, it addresses an internal error when getting customer data with a null key, and an unexpected feedback message when saving a new order product without passing the required order ID. The recommended fixes are to check for null keys before database calls, and pass the order ID as an input when saving related records.

Uploaded by

Carlos Junior
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Service Center

Error Log - Common Errors Exercise


Common Errors Exercise
Part I - Internal Error Screen

Part II - Unexpected Feedback Messages


Part I - Internal Error Screen
1. Open the Orders Application with the green icon in the environment.
2. Open the module and clone it. Close the main module.
3. Rename the clone module to have your name initials:Orders_<initials>
4. Publish it and open it in the browser.
5. Navigate to the Orders screen.
6. Oops...You found an Internal Error Screen while in runtime.

What to do next?

7. Investigate it: Open Service Center and search for your application's errors:
a. Click the gear in Service Studio

b. When the Service Center application opens in the browser, log in with your IT user if
required.
c. Click Monitoring and then Errors.
d. Filter the search by your Application name.
e. You should see the error log as in the image below.

8. Analyze it: Open the Detail of the error and analyze the information:
a. If you look at the Stack section, you will notice some hints that you can follow to find
the cause of the error.
[OUTSYSTEMS].DBO.[OSUSR_53I_CUSTOMER] with key 0 was not found

at ssCustomerOrders.ExtendedActions.GetCustomer (HeContext heContext,

Int64 inParamId, RCCustomerRecord& outParamRecord)

at ssCustomerOrders.Functions.ssGetCustomer(HeContext heContext,

Int64 inParamId)

at ssCustomerOrders.Flows.FlowMainFlow.ScrnOrders.expression3()

at ASP.orders_aspx.__DataBind__control82(Object sender, EventArgs e)

at System.Web.UI.Control.OnDataBinding(EventArgs e)

at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)

at OutSystems.HubEdition.WebWidgets.PlaceHolder.DataBindChildren()

at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)

at OutSystems.HubEdition.WebWidgets.PlaceHolder.DataBind()

at OutSystems.HubEdition.WebWidgets.OSDataGridTableCell.

DataBindChildren()

at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)

at OutSystems.HubEdition.WebWidgets.OSDataGridTableCell.DataBind()

at OutSystems.HubEdition.WebWidgets.OSDataGridItem.DataBindChildren()

at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)

at System.Web.UI.WebControls.DataGrid.CreateItem (Int32 itemIndex,

Int32 dataSourceIndex, ListItemType itemType, Boolean dataBind,

Object dataItem, DataGridColumn[] columns, TableRowCollection rows,

PagedDataSource pagedDataSource)

at ...

9. Understand it: The error should be in your Orders module, in the Orders screen, in the
Orders Table, in the last column cell inside the expression.
So, we have that GetCustomer() function in the Orders screen.

But why does the error state that the input is 0?

Well, it seems that the foreign key RequestedBy in the Orders entity is not mandatory,
and that means that there may be Order records that have a Null Identifier as the
attribute's value. So, when using the GetCustomer() function to find a record that does
not exist, the database raises an exception, and all of this occurs.

Great! You found it and understood it! Now you just need to fix it!

10. Know your options: the first step in fixing errors is knowing what your options are, and
that is something that will come easier with experience, we promise. To guide you, we will
present you with two common approaches:
a. Make sure the function GetCustomer() is not called when its Customer Identifier input
does not exist in the database, in this case, that is not a Null Identifier
OR

b. Since it is called in a table row and there is an existing database relationship between
the entities Order and Customer fetch the information in the query that sources the
table instead of calling the GetCustomer() function.
Note: The best approach, in this case, would be option b. When you use the
GetCustomer() function inside of a table records, there is a call to the database for
each record of that list.

So if we can fetch the information inside of the aggregate that sources the table, we
only have one call to the database and avoid harming the performance by having
multiple calls to the database in that table.

11. Fix it: implement both approaches, one at a time.


Did both solve the error? Cool! Let's review it...

a.

b.
Part II - Unexpected Feedback Messages
1. In the browser, go to the Orders screen (of the Orders application you cloned in the
exercise above) and open the detail of an Order.
2. Click the New Order Product, fill in the fields, and click save. What happens?

An unexpected feedback message appears.

3. Follow the same approach as earlier: Investigate, Analyse, Follow the hints, Understand,
Know your options and Fix the error.

4. Solve the error: In Service Center, as we read the stack trace, we see that the problem is
the attribute OrderId, a foreign key in the OrderProduct entity. So let's look at the entity.
The attribute OrderId exists in the entity and is set as mandatory. What happens when we
try to create a new record in the database without providing existing identifiers for all the
mandatory foreign keys?

That is right! A database exception occurs.

5. Debug the code to see it:


a. Place a breakpoint in the Save screen action of the popup and then click the Start
Debugging blue button.

b. Again, in the browser, click the New Order Product link, fill in the details and click the
Save button.
It is possible to see that the exception raised where Service Center showed it did. And
we do have the order attribute with a value that does not exist in the Orders entity.
Hence the unexpected feedback message.

6. To solve this problem, we have to ensure that the CreateOrUpdateOrderProduct action


source input has a valid value for the OrderId attribute.
a. To do so, we need to pass the value from the OrderDetail screen to the popup using
an input

b. After that, in the flow of the Save screen action, the value must be assigned to the
source of the CreateOrUpdateOrderProduct action.
7. Publish it and test it. You should already be able to add new products to an order.

You might also like