25
Views
10
Comments
Error: Object cannot be cast fromĀ  DBNull to other types
Application Type
Reactive
Service Studio Version
11.54.54 (Build 63219)

Hello Experts,

I have customers list page and there is button called "Add customer". After clicking add customer below popup will open.

Only name is mandatory in form. When I am saving it, it is giving error. But If I filled all fields data, it is saving successfully.

What should I do?


Add customer action is below:

customer operation wrapper is below:


2024-03-22 09-17-23
Chandra Vikas Sharma

Hi Nayana,

Please go through below post. seems like same issue

https://www.outsystems.com/forums/discussion/44366/object-cannot-be-cast-from-dbnull-to-other-types/

Thanks

CV

2024-04-30 10-44-32
Nayana Chaudhari

@Chandra Vikas I didn't find my answer in above link. What exactly i need to check?

2019-04-09 00-57-55
carl ruhle

Hi Nayana

assign zero to the numeric fields by default. From what I understood that may be the cause for the error that you are getting. 

Regards 

2019-09-17 11-09-41
Miguel Guerreiro

Hi Nayana.

Can you please share the structure of the database table and also the debug values when it reaches the CreatetblCustomer?

Regards

2019-01-07 16-04-16
Siya
Ā 
MVP

The error suggests that your entity contains fields expecting non-null values, but null values are being sent. Please review your entity to identify any mandatory fields that might not be receiving data. Additionally, consider hidden attributes not displayed on your form (e.g., CreatedBy, CreatedOn) that are typically set on the server before saving to the database.

2024-04-30 10-44-32
Nayana Chaudhari

My table structure is below:

2019-09-17 11-09-41
Miguel Guerreiro

Hi Nayana.

Can you please also share the debug values when it reaches the CreatetblCustomer?

Is it possible to share the OML as well?

Regards

2019-04-09 00-57-55
carl ruhle

Hi Nayana,

the last field isActive its mandatory, my guess is here, maybe you could assign a default value on that field. 

Regards

2024-04-30 10-44-32
Nayana Chaudhari

this field we have added recently. Earlier also we were facing same error

2019-04-09 00-57-55
carl ruhle

Nayana,

try giving all the text fields a default value as you've done with the numeric fields, I think that will bypass the problem. 

What I mean is the fields that appear on the form, would try first with those.

Regards 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.