Hi, guys,

I have a single screen that shows different web blocks depending on my choice.

On the 1st web block it shows the records on a table records.

On the other it must allow me to edit the record or create a new one. Each record has an Id so that the app can know if you are trying to edit a existing record or create a new one.

The problem, I believe, is when I pass this Id, because when I try to edit an existing record, it shows me the inputs filled with the last record recorded info. And when I save, it doesn't edit that record, it always creates a new one.

I've already made all this using web screens, but now I need to use only one, and for this, I need to use web blocks, so the logic is a bit different, because it uses events.

Hope I've been clear enough so that you can help me (:


Best regards,

Eduardo Coelho


Hi, friend.

Usually, that kind of errors happens because you're passing the wrong Id to the CreateOrUpdate. It's a very very common error.

Look to the data you're passing as parameter. Verify if you're really passing the CURRENT ID of the record list/table.


Best regards

Bruno Miguel das Neves Rendeiro wrote:

Hi Eduardo


Take a look

https://success.outsystems.com/Documentation/11/Developing_an_Application/Design_UI/Reuse_UI/Use_Events_to_Propagate_Changes_From_a_Block_to_the_Parent


Hi, Bruno,

I've already read this article. It helped me start using events. I'm already using it to other functionalities.
I guess my post is a little bit more especific.

But thanks.


Eduardo Coelho

Solution

Hi Eduardo,

The 2nd web block must have as input parameter the record ID and on it's preparation action it's necessary to fetch the record from the DB. If you pass a nullidentifier() the form will me empty and when save it will create a new record. Otherwise, if you passed an ID you will fetch the record and can edit/save it.

All the best

Solution

Ricardo Cruz wrote:

Hi Eduardo,

The 2nd web block must have as input parameter the record ID and on it's preparation action it's necessary to fetch the record from the DB. If you pass a nullidentifier() the form will me empty and when save it will create a new record. Otherwise, if you passed an ID you will fetch the record and can edit/save it.

All the best


Thanks, Ricardo!

You clarified my mind.


Best regards,

Eduardo Coelho