cancel
Showing results for 
Search instead for 
Did you mean: 

How to Save a created BO Instance Without Saving The Main Instance?

Former Member
0 Kudos

Hi everyone,

I have a custom BO, called TimeSheet that holds an EmployeeID and a MonthYear date.

In the UI, I have a "PreviousMonth" button and a "PreviousMonth" BO Action where I create a new instance of the BO with another date. Up until recently, just after the PreviousMonth button was clicked I just saved and closed the window and both instances were in the list when I was back in the OWL. But now, there are cases when I don't want to save the first instance because it is already in the database, but I always want to save the previousMonth instance. If I save and close, it creates a duplicated timesheet and a new one for the previous month. If I just close without saving, the previoiusmonth instance is not created.

I am missing a Save method to force save the previousmonth instance and then close without saving.

How can I do to solve this ?

Best Regards

Chris

Accepted Solutions (1)

Accepted Solutions (1)

former_member200567
Active Contributor
0 Kudos

Hi Christophe,

       You can write this.Delete() at the end of your BO Action.

Best Regards

Fred

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Christophe,

Wouldn't it be better if you first look if there is already an instance for the choosen month and use it in the case it exists?

So you wouldn't get duplicates.

HTH,

    Horst

Former Member
0 Kudos

Thanks Fred, that works !

I thought it would kill the father and son instances but the this.delete() only deletes the upper instance and when I leave the screen, its saves the new son instance as expected.

Thank you very much

Former Member
0 Kudos

Thanks Horst for your answer, but in this case, the "duplicate instance" is a mandatory step in the two step process. The delete function applied to the father instance does what I need as Fred K said.

Regards

Chris

Answers (0)