why cannot I use the data from the from in my safe action

Hello, 


I try to save all the data from a form that I made. 

But on some wierd way I can only use null identifier as source and not the form.

What have I done wrong ?

I did the reactive course and trying in a personal project to use what I have learned. 


Roelof



Hi Roelof , 


Who you are writting in the Database?

 I see your OML and you are not using the CreatOrUpdateCostumer or UpdateCostumer from the Data .







hmm, 


I use the UpdateCustomer in the saveOnClick Action or are we talking about different things here. 


Roelof

Hi Roelof,

The input parameter of the CustomerUpdate server action is of type Customer Identifier, where it should be of type Customer.


Furthermore, you're using the server action CustomerUpdate in itself, where you should use the UpdateCustomer Entity action from the Data tab. Meaning, the CustomerUpdate server action is a wrapper around the UpdateCustomer Entity action.

Hope this helps,

Nordin

First i think you have to put the input parameter the list current of the costumer form in the save .


After, you have in your logic just use the action in costumer Database CreateOrUpdate and that the Source will be your input Costumer like i do in the Attachment.

Hope it Help

Roelof Wobben wrote:

hmm, 


I use the UpdateCustomer in the saveOnClick Action or are we talking about different things here. 


Roelof


The action that you use in Save On click is Logic , in that logic you have to send to the DB the information using the Create, CreateOrUpdate or just Update inside the Aggregate after all the validations.

thanks

But I see the same problem. When I add a new customer the old one get overwritten. 

Roelof Wobben wrote:

Hello, 


I try to save all the data from a form that I made. 

But on some wierd way I can only use null identifier as source and not the form.

What have I done wrong ?

I did the reactive course and trying in a personal project to use what I have learned. 


Roelof



Hi Roelof you are doing some recursiveness calling the customer upadate inside the custumer update

And a few other things during the save and instead pass the record you try to save passing just the Id

check the 0ml attached and let me know if work

Roelof Wobben wrote:

thanks

But I see the same problem. When I add a new customer the old one get overwritten. 


Because you are only using the update, you have to use the CreateOrUpdate , the system will see by the ID .

If the Id is new they gonna Create, if not they will Update.


In your logic you can also control that with a simple If .


Roelof Wobben wrote:

thanks

But I see the same problem. When I add a new customer the old one get overwritten. 


check my previous answer, there is working fine

Roelof Wobben wrote:

thanks

But I see the same problem. When I add a new customer the old one get overwritten. 

One more thing Roelof.

Your CustomerInput block which contains the Form, has an aggregate GetCustomers. This aggregate should have a filter on CustomerId since you are trying to update a single record of the Customer Entity.

Therefore, you should create an input parameter of type CustomerId for your CustomerInput block and filter on it in your aggregate.

Hope this helps.

Regards,

Nordin


Solution

Carlos Lessa wrote:

Roelof Wobben wrote:

Hello, 


I try to save all the data from a form that I made. 

But on some wierd way I can only use null identifier as source and not the form.

What have I done wrong ?

I did the reactive course and trying in a personal project to use what I have learned. 


Roelof



Hi Roelof you are doing some recursiveness calling the customer upadate inside the custumer update

And a few other things during the save and instead pass the record you try to save passing just the Id

check the 0ml attached and let me know if work

Here withbetter explanation of steps:

added input parameter in the webblock and pointed to the local variable

In the aggregate of the block filter by the input parameter

added an action to handler the parameterchange

 on save on click added the current custmer record

 and in the end an createOrUpdate action

Solution

thanks, 


I can now add  customers but I do not see that the list is updated and the screen is still seen. 

I think this idea is too much.  I try now for a few days to make it work. 

First lunch

Roelof Wobben wrote:

thanks, 


I can now add  customers but I do not see that the list is updated and the screen is still seen. 

I think this idea is too much.  I try now for a few days to make it work. 

First lunch

Did you checked my oml in the previous post?


yep. I did as far as I thougt.


I use now the one you posted some 25 min ago.

if that is the right one, I better can delete my own one and use yours then 

Roelof Wobben wrote:

yep. I did as far as I thougt.


I use now the one you posted some 25 min ago.

if that is the right one, I better can delete my own one and use yours then 

Yes, you can.

Good, I could help you.

So if my solution or ideas was the one that solved your problem, please mark my answer as the solution and help me to grow my rank in the community, thanks and good code


Wierd, this version does not update the list. 



Roelof Wobben wrote:

Wierd, this version does not update the list. 



This one does, the other was the old one, check now this oml


oke

have to figure out why when I click on the oml  I see this wierd errorr : 


Foreign Module Error

Your OutSystems subscription only allows uploading modules developed in your environment, or downloaded from the OutSystems Forge. To share this module with the community, upload it at http://www.outsystems.com/goto/forge.

Roelof Wobben wrote:

oke

have to figure out why when I click on the oml  I see this wierd errorr : 


Foreign Module Error

Your OutSystems subscription only allows uploading modules developed in your environment, or downloaded from the OutSystems Forge. To share this module with the community, upload it at http://www.outsystems.com/goto/forge.

This is because we use the FREE version of Outsystems what mean we cannot reuse(just upload a version of another environment oml), you need to check what I did inside and change on yours.

But the solutions is there. you can check here how it's working


oke


Checked all the steps but as far as I can see, I have exactly the same code as you described in the steps. 


Very wierd

Carlos Lessa wrote:

Roelof Wobben wrote:

oke

have to figure out why when I click on the oml  I see this wierd errorr : 


Foreign Module Error

Your OutSystems subscription only allows uploading modules developed in your environment, or downloaded from the OutSystems Forge. To share this module with the community, upload it at http://www.outsystems.com/goto/forge.

This is because we use the FREE version of Outsystems what mean we cannot reuse(just upload a version of another environment oml), you need to check what I did inside and change on yours.

But the solutions is there. you can check here how it's working


Btw this error is strange cuz I took your oml and published in my environment


Roelof Wobben wrote:

oke


Checked all the steps but as far as I can see, I have exactly the same code as you described in the steps. 


Very wierd

send you oml in the version you have now


Here is the oml file that I used now 

Roelof Wobben wrote:

Here is the oml file that I used now 

Definitely not the same:

yours doesn't have the event that refreshes the list. and others.

correct and let me know if works now

it works finally

Roelof Wobben wrote:

it works finally

Good I could help you, good code


yep, 

 

And I see again, you really learn again when you try some things out.

Following the videos and assigments learn you a thing but you know for sure that you really understand things if you try it yourself, fail, learn from it, and try again.

Roelof Wobben wrote:

yep, 

 

And I see again, you really learn again when you try some things out.

Following the videos and assigments learn you a thing but you know for sure that you really understand things if you try it yourself, fail, learn from it, and try again.

Yes, the videos are the base, to improve you need to try, try and try until you get done, good code